Github Actions as Status checks?

I’m a bit surprised, but it looks like github actions aren’t defined as a pass/fail for a status check - is there a reason we’ve chosen not to integrate Actions into the status checks that we want to have pass before a PR, etc.

10 Likes

I’m not sure that I entirely understand your question.  GitHub Actions act as status checks when they’re set up to trigger on: [pull_request].  Can you point me to your workflow if you’re not seeing those reported in the checks area?

2 Likes

Hi @ethomson ,

What we are seeing in our Github Actions workflow is that the workflow itself is reporting as a status check, but the underline jobs that belong to the workflow are not.

So in the GitHub branch protection settings for our repo, we can’t set any Github Actions Job as a required check.

2 Likes

@duanshiqiang wrote:

So in the GitHub branch protection settings for our repo, we can’t set any Github Actions Job as a required check.

Correct, in this regard the status checks for GitHub Actions work like any other automation tool such as Travis CI. The only thing that you can have a status check against is the workflow in it’s entirety. It would be an interesting feature to have the option to have each job reported as a separate status check, but at this point there’s no option for that. You’ll have to split up your jobs over multiple workflows in order to get separate status checks for each of them.

2 Likes

It is possible to manually create a status check using the api: https://github.com/qawolf/actions-test/blob/master/.github/actions/create-status-check/index.js#L15-L27

But that only works on push, not a schedule: https://github.community/t5/GitHub-Actions/Github-Actions-Status-Checks-created-on-incorrect-Check-Suite-Id/m-p/36180

It would be nice if you could output the status check results from a job, and for that to automatically create a status check associated with the same check suite as the run.

1 Like

Hi @oldskool ,

Thanks for your reply. I see your point, but actually the status checks for Github Actions doesn’t work like all third-party CI platforms.

In CircleCI (with their 2.1 pipeline), we can only set status check for a job under a workflow instead of vice versa.

And one very strange thing about the workflow status check of Github Actions is that once actual jobs kick-started, the status check of the workflow is gone. Even if one of the jobs under the workflow is failed, we can still merge our PR.

I’m unclear after 20+ minutes exploring the docs how to explicitly output a pass or fail for a workflow. How does this system decide if a workflow passes or fails? It would be useful to define status checks easily with workflows folder, but if it isn’t documented, it doesn’t exist

2 Likes

It seems to be based on exit codes.

exit code 0 = ok

exit code x = ko

my last tests with this works fine.

GitHub Actions act as status checks when they’re set up to trigger on: [pull_request].

I can’t find this in the documents of github action.

Am i miss something or can github update document to point this out?

Ye i found it stupid that you cant set it as a status check on the branch policy (like you can is azure pipelines).

But as long as the GitHub action file has the on pull request trigger you can find the results under ‘checks’ on the PR.

on:
  pull_request:
    branches: [ master ]

Anyone able to point to any docs or summarize?

I have github action running a docker-compose based integration test and can’t figure out how to
A) set the exit code correctly as the tests are running as a docker container as part of a docker-compose set of services
B) how to make the github action a required check for PRs

there might be a bug over there. our setup is that both initial PR creation and a comment “build” would trigger a deployment action. ideally i want every deployment to report back status here however only the initial PR creation can do so. if i wanna see the status, i have to click through the Actions tab :crying_cat_face:

the following image actually shows the bug: the status got stuck in this state ¯\_(ツ)_/¯

It seems that at least a part of the concerns raised here are addressed! Because of this thread, I thought I would have to use some API trickery to update the status, as discussed. However, after creating a workflow and letting it run on a push to master, the status of that commit was automatically updated!

I did not do anything out of the ordinary:

on:
  push:
    branches:
      - master
    tags-ignore:
      - '*'
  pull_request:

but this produced a commit status for me. For context, see the commit and discussion.

Can anybody else confirm that this is the case? Even GitHub staff?

I believe that’s a Check, not a Status. They appear much the same in the Github UI, but they’re not totally interchangeable - eg deployments’ required_contexts attribute needs a Status rather than a Check.

I see, thanks a bunch for the clarification!