Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
check-circle

GitHub Action

Workflow Conclusion Action

v1.1.1

Workflow Conclusion Action

check-circle

Workflow Conclusion Action

GitHub action to get workflow conclusion

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Workflow Conclusion Action

uses: technote-space/[email protected]

Learn more about this action in technote-space/workflow-conclusion-action

Choose a version

Workflow Conclusion Action

CI Status codecov CodeFactor License: MIT

Read this in other languages: English, 日本語.

GitHub action to get workflow conclusion.

Table of Contents

Details

Usage

e.g. Lint => Test => Publish (only tagged) => slack (only if any job fails)

on: push

name: CI

jobs:
  lint:
    name: ESLint
    runs-on: ubuntu-latest
    ...

  test:
    name: Coverage
    needs: lint
    strategy:
      matrix:
        node: ['11', '12']
    ...

  publish:
    name: Publish Package
    needs: test
    if: startsWith(github.ref, 'refs/tags/v')
    ...

  slack:
    name: Slack
    needs: publish # set needs only last job except this job
    runs-on: ubuntu-latest
    if: always() # set always
    steps:
        # run this action to get workflow conclusion
        # You can get conclusion by env (env.WORKFLOW_CONCLUSION)
      - uses: technote-space/workflow-conclusion-action@v1
      - uses: 8398a7/action-slack@v2
        with:
          # status: ${{ env.WORKFLOW_CONCLUSION }} # neutral, success, cancelled, timed_out, failure
          status: failure
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
        if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure

Success

Success

Slack action step is skipped because all jobs are success.

Failure

Failure

Slack action step has been executed even if some jobs were skipped.

Author

GitHub (Technote)
Blog