Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Netural status is no longer supported by Github #31

Closed
tannerbaum opened this issue Jun 24, 2022 · 2 comments
Closed

Netural status is no longer supported by Github #31

tannerbaum opened this issue Jun 24, 2022 · 2 comments

Comments

@tannerbaum
Copy link

Unfortunately it seems like Github dropped the neutral exit code a year or two back and have yet to replace it with anything, which is quite annoying.

actions/runner#662
https://github.community/t/github-actions-neutral-exit-code-is-incorrectly-interpreted-as-failure/16088

It is still in the actions-toolkit because that package hasn't been updated in a couple of years either.

This was a bummer because I was really looking forward to the possibility of having a neutral exit like @moritzjacobs originally suggested. I think I will be able to manage without it though.

@mheap
Copy link
Owner

mheap commented Jun 25, 2022

This is resolved in #32, which has just been released and is available as @v2.

There is now an output that you can use to simulate the neutral exit code:

name: Pull Request Labels
on:
  pull_request:
    types: [opened, labeled, unlabeled, synchronize]
jobs:
  label:
    runs-on: ubuntu-latest
    outputs:
      status: ${{ steps.check-labels.outputs.status }}
    steps:
      - id: check-labels
        uses: mheap/github-action-required-labels@v2
        with:
          mode: exactly
          count: 1
          labels: "semver:patch, semver:minor, semver:major"
          exit_type: success
  do-other:
    runs-on: ubuntu-latest
    needs: label
    steps:
      - run: echo SUCCESS
        if: needs.label.outputs.status == 'success'
      - run: echo FAILURE && exit 1
        if: needs.label.outputs.status == 'failure'

@mheap mheap closed this as completed Jun 25, 2022
@tannerbaum
Copy link
Author

@mheap this is beautiful, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants