Check_run webhooks being sent twice

Hi GitHub,

I’m currently working with Check_run webhook and encountered a weird bug (feature ?): Sometimes the “created” webhook is being sent twice for a same job when launching a GitHub action workflow…

I did some testing and here are the behaviors i gathered:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: hello world
        id: hello_world
        shell: bash
        run: echo 'hello world'

=> 1 webhook received (OK)

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: hello world
        id: hello_world
        shell: bash
        run: echo 'hello world'
  test2:
    runs-on: ubuntu-latest
    steps:
      - name: hello world
        id: hello_world
        shell: bash
        run: echo 'hello world'

=> 2 webhooks received (OK)

jobs:
  test:
    runs-on: self-hosted
    steps:
      - name: hello world
        id: hello_world
        shell: bash
        run: echo 'hello world'

=> 2 webhooks received (expected 1 webhook)

jobs:
  test:
    runs-on: self-hosted
    steps:
      - name: hello world
        id: hello_world
        shell: bash
        run: echo 'hello world'
  test2:
    runs-on: self-hosted
    steps:
      - name: hello world
        id: hello_world
        shell: bash
        run: echo 'hello world'

=> 3 webhooks received (expected 2 webhooks / sometimes first job is sent twice, sometimes it’s the second one)

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: hello world
        id: hello_world
        shell: bash
        run: echo 'hello world'
  test2:
    runs-on: self-hosted
    steps:
      - name: hello world
        id: hello_world
        shell: bash
        run: echo 'hello world'

=> 3 webhooks received (expected 2 webhooks / test2 sent twice)

jobs:
  test:
    runs-on: self-hosted
    steps:
      - name: hello world
        id: hello_world
        shell: bash
        run: echo 'hello world'
  test2:
    runs-on: ubuntu-latest
    steps:
      - name: hello world
        id: hello_world
        shell: bash
        run: echo 'hello world'

=> 3 webhooks received (expected 2 webhooks / test sent twice)

Anyone encountered this weird behaviour ?

Thanks in advance

EDIT: added a use cases

1 Like

Hi @jbwintergerst,

Glad to see you in Github Community Forum!

Could you please let me know how you check the webhook for check_run?

Are you checking in the payload with webhook (screenshot below)? Or in some other way? Could you please provide a screenshot or logs for a check?

Thanks

Hi @weide-zhou,

I indeed use webhooks to check for new jobs, here’s my config:


(only selected event is “Check runs” and the “Active” check box at the bottom is also checked)

Here is an example of a payload being sent twice:


Thanks for your help

Hi @jbwintergerst,

Thanks for your reply!

Checked on my side, the ‘check_run’& ‘created’ webhook is sent only once for each job.

I notice the checkrun urls (hightlighted below as sample) in your payload are different, which means they are different checkruns. Is it possible that the workflow is triggered twice? Could you please check the two checkruns?

If it’s still reproducible on your side, please ask private support in below link:
https://support.github.com/contact

Thanks

I also noticed that the check run’s ids where different, thus different jobs, and I also thought of a job being triggered twice.
But the whole workflow is, I’m pretty sure, being run once since I only receive 3 payload (and not 4) for a 2 jobs workflow. Furthermore, both payload have the same “Check_suite” id (strange).

Note that the “double webhook” only occurs when using the “runs-on: self-hosted” config.
“runs-on: ubuntu-latest” jobs work fine.

Problem must be elsewhere. I’ll continue to tinker with it and if i find a reproducible behavior, I’ll contact support.

Thanks for your time and help !

Hi @jbwintergerst,

I also checked for ‘runs-on: self-hosted’ config, but still not reproduce on my side.
Are there two self-hosted runners on your repository? If not, and the issue persists on your repo, please directly contact support.

Thanks

Could this be due to my repo having an always offline runner registered ? (online runners are added after a few minutes following the job request)

Hi @jbwintergerst,

Offline runner registered will not be used for workflow.

You can add a ‘hostname’ command to the job, and try to reproduce again.
Navigate to the checkruns based on the url in the duplicated payloads, check the self-hosted runner hostname to find the runner.

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: hello world
        id: hello_world
        shell: bash
        run: echo 'hello world'
  test2:
    runs-on: self-hosted
    steps:
      - name: hello world
        id: hello_world
        run: |
          echo 'hello world'
          hostname               #check runner hostname

It’s recommended to use an idential label instead of ‘self-hosted’ for the config.

Thanks

It appears to be fixed by using a label on the runner and job config.
I don’t know what fixed it and why, but using label seems the way to go.

Problem solved

Thanks again for your help !

EDIT: Problem came back

It worked for a while, but the problem came back this morning, so the use of labels is not a 100% working solution unfortunately

EDIT –

Furthermore, a config that worked yesterday (only 1 payload) doesn’t work anymore (sends 2 payloads now).
I couldn’t be more confused…

EDIT 2 – Contacted support