Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/samhammerag/last-successful-build-action
Action to find the sha of the last successful workflow of a branch.
https://github.com/samhammerag/last-successful-build-action
github-actions
Last synced: 23 days ago
JSON representation
Action to find the sha of the last successful workflow of a branch.
- Host: GitHub
- URL: https://github.com/samhammerag/last-successful-build-action
- Owner: SamhammerAG
- License: mit
- Created: 2021-04-22T13:17:22.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-08-07T06:31:40.000Z (5 months ago)
- Last Synced: 2024-08-08T09:54:31.723Z (5 months ago)
- Topics: github-actions
- Language: TypeScript
- Homepage:
- Size: 53.7 KB
- Stars: 12
- Watchers: 2
- Forks: 14
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# last-successful-build-action
This action searches for the last successful workflow-run for the given workflow-name and branch.
The `sha` of the workflow-commit is set as output-parameter. If no matching workflow exists, the `sha` of the current run is emitted.## Required Permissions:
The Action requires the permission "read" for the "Actions" scope. This is set by default if you've configured your repositories Workflow permissions to "Read and write permissions". Alternatively you can explicitly set the permissions for the "actions" scope to "read" (see [githubs docs](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs#overview))## Usage
```yml
- uses: actions/checkout@v3
- name: Find matching workflow
uses: SamhammerAG/last-successful-build-action@v4
with:
token: "${{ secrets.GITHUB_TOKEN }}"
branch: "development"
workflow: "build"
```## Verifying workflow run SHAs
If your workflow runs are expected to contain no-longer existing commit SHAs (e.g. when squashing and force pushing) you need to verify the SHA of the workflow run commit against the list of commit SHAs in your repository.```yml
- uses: actions/checkout@v3
with:
fetch-depth: 0 # check out the entire repo history for SHA verification
- name: Find matching workflow
uses: SamhammerAG/last-successful-build-action@v4
with:
branch: "development"
workflow: "build"
verify: true
```## Config
### Action inputs| Name | Description | Default |
| --- | --- | --- |
| `token` | `GITHUB_TOKEN` or a `repo` scoped [PAT](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). | `GITHUB_TOKEN` |
| `branch` | Branch for the workflow to look for. | "" |
| `workflow` | Workflow name to look for. | "" |
| `job` | Job name to look for. | "" |
| `verify` | Verify workflow commit SHA against list of SHAs in repository | `false` |
| `fallbackToEarliestSha` | If SHA of last successful commit can not be determined, use earliest (true) or triggering sha (false) | `false` |### Action outputs
| Name | Description | Default |
| --- | --- | --- |
| `sha` | Sha of the workflow-run matching the requirements. | `${{ github.sha }}` |
| `run-id` | Id of the workflow-run matching the requirements. | `${{ github.run_id }}` |