Skip to content

MercymeIlya/last-workflow-status

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License: MIT

Last workflow status

Simple GitHub Action to get the previous workflow run's conclusion/status on the current branch.

Inspired by Travis CI's on_success: change notification feature — useful for sending alerts only when the build status changes.

Inputs

github_token

  • Secret GitHub API token used for API requests.
  • Default: ${{ github.token }} — works automatically, no need to pass it explicitly unless you need a custom token.

Outputs

last_status

  • Conclusion of the last completed workflow run. Possible values:
    • success, failure, cancelled, skipped, timed_out, action_required, neutral, stale
    • null — if there is no previous run

See GitHub docs for more details on conclusion values.

Example usage

jobs:
  your-job:
    runs-on: ubuntu-latest
    steps:
      - name: Get previous workflow status
        uses: Mercymeilya/last-workflow-status@v0
        id: last_status

      - name: Any action
        run: style-check.sh

      - name: Build fixed slack message
        uses: rtCamp/action-slack-notify@v2.1.3
        if: ${{ success() && steps.last_status.outputs.last_status == 'failure' }}
        env:
          SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
          SLACK_MESSAGE: 'Style check fixed now!'

About

Get the conclusion/status of the previous workflow run on the current branch. Useful for detecting build status changes (e.g., send a Slack notification only when a build goes from failing to passing).

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors