Skip to content

crustacean-dev/latest-workflow-run-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest Workflow Run Action

Gets the latest completed run of the current workflow on the current branch.

Useful for comparing artifacts, caches, or outputs between the current run and the previous successful one (e.g. bundle size diffs, performance regressions).

Usage

- uses: crustacean-dev/latest-workflow-run-action@v1
  id: latest-run
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}

- run: echo "Latest run ID: ${{ steps.latest-run.outputs.run-id }}"
  if: steps.latest-run.outputs.found == 'true'

Inputs

Name Required Default Description
github-token Yes Token for the GitHub API
conclusion No success Filter by conclusion: success, failure, cancelled, or empty for any

Outputs

Name Description
run-id The ID of the latest matching workflow run (empty if none found)
found Whether a matching run was found ('true' or 'false')

Examples

Download artifacts from the previous successful run

- uses: crustacean-dev/latest-workflow-run-action@v1
  id: latest-run
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/download-artifact@v4
  if: steps.latest-run.outputs.found == 'true'
  with:
    name: build-output
    run-id: ${{ steps.latest-run.outputs.run-id }}
    github-token: ${{ secrets.GITHUB_TOKEN }}

Find the latest run regardless of conclusion

- uses: crustacean-dev/latest-workflow-run-action@v1
  id: latest-run
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    conclusion: ""

How it works

  1. Detects the current branch (supports both push and pull_request events)
  2. Resolves the numeric workflow ID from the current run
  3. Queries the GitHub API for the latest completed run matching the branch and conclusion filter

License

MIT

About

Resolve and interact with the latest workflow runs

Topics

Resources

License

Stars

Watchers

Forks

Contributors