Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write a GitHub Action with a neutral Check Run status

I'm writing a GitHub action and want to indicate success, warn (neutral), and failure. It looks like this:

name: status

on: 
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: run checks
      continue-on-error: true
      run: ./check.sh

I discovered through some old documentation that exit code 78 gives a neutral status for the step. But how do I give the entire job a neutral status?

Update: After testing, I discovered that exit code 78 does not affect the status of the step.

like image 613
Ann Kilzer Avatar asked Aug 28 '19 07:08

Ann Kilzer


1 Answers

I don't think the current GitHub Actions runtime allows this functionality yet. You can see at the following link that the official Actions toolkit has a test ready for it, but it's not implemented properly yet.

https://github.com/actions/toolkit/blob/master/packages/core/tests/lib.test.ts#L128-L131

The official documentation also confirms that there are only two statuses currently. 0 for success and non-zero for failure. https://help.github.com/en/articles/virtual-environments-for-github-actions#exit-codes-and-statuses

GitHub checks can have neutral statuses, as can be seen from the API docs at the following link. So I think it's just a matter of time before they add it. https://developer.github.com/v3/checks/runs/

There is a similar question that I answered here. I don't think it's a solution to your particular use case, but it's related enough that it might be useful. Github Actions: check steps status

Update: I found an issue on the Actions toolkit repository asking about the same setNeutral test that I found. Hopefully we'll get an answer there. https://github.com/actions/toolkit/issues/146

like image 139
peterevans Avatar answered Oct 03 '22 14:10

peterevans