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

Cancelled workflow reported as error #48

Open
tbekaert opened this issue Jan 11, 2021 · 2 comments
Open

Cancelled workflow reported as error #48

tbekaert opened this issue Jan 11, 2021 · 2 comments

Comments

@tbekaert
Copy link

Hi !

I use this action to trigger a slack notification once every job has finished in a PR workflow.

My problem is I use n1hility/cancel-previous-runs to cancel previous run attached to that PR and wait-for-status report those cancelled jobs as errors.

Can it be possible to report them as cancellation?

Here is the slack job I use, for reference:

slack:
    name: Send slack notification
    runs-on: ubuntu-latest
    if: always()
    needs: [standard,jest]
    steps:
      - name: Wait for status checks
        id: waitforstatuschecks
        uses: "WyriHaximus/github-action-wait-for-status@v1"
        env:
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
        with:
          checkInterval: 10
          ignoreActions: Send slack notification
      - name: Send PR slack notification
        uses: edge/simple-slack-notify@master
        env:
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
          GITHUB_CONTEXT: ${{ toJson(github) }}
        with:
          status: ${{ steps.waitforstatuschecks.outputs.status }}
          success_text: 'Tests on PR "${{github.event.pull_request.title}}" (<${{github.event.pull_request._links.html.href}}|${{github.head_ref}}>) completed successfully'
          failure_text: 'Tests on PR "${{github.event.pull_request.title}}" (<${{github.event.pull_request._links.html.href}}|${{github.head_ref}}>) failed'
          cancelled_text: 'Tests on PR "${{github.event.pull_request.title}}" (<${{github.event.pull_request._links.html.href}}|${{github.head_ref}}>) was cancelled'

Thanks :)

@WyriHaximus
Copy link
Owner

Hey @tbekaert that should be possible and not too hard to do. Might export it as a conclusion tho because it would be a BC break to replace failure for cancelled cases.

@webknjaz
Copy link

I just want to warn that GitHub's branch protection treats skipped and neutral statuses (that are often results of dependent job cancellation) as "not failure == success". So such an ask might be dangerous if used carelessly.
I've got some bits of explanation in another action's readme: https://github.com/marketplace/actions/alls-green#why.

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

3 participants