For the sake of supply chain security, every reference from a workflow to an action identifies the action’s version by a commit hash rather than a tag or branch name. This ensures reproducibility and prevents supply chain attacks through action tampering.
The file .gha-reversemap.yml in the root of the repository is the single source of truth for the mapping from action identity (owner/repo) to commit hash. This file should be updated when you have confidence in the new or added version.
The script hack/gha-reversemap.sh provides commands for managing GitHub Action references across workflows.
| Command | Description |
|---|---|
update-action-version | Updates an action to its latest version in the reversemap file |
apply-reversemap | Distributes the reversemap specifications to all workflow files |
verify-mapusage | Verifies that all workflow files use correct commit hashes |
update-reversemap | Update the reverse map values based on given workflow files |
To update an action (e.g., actions/checkout) to the latest version:
hack/gha-reversemap.sh update-action-version actions/checkout
hack/gha-reversemap.sh apply-reversemap
The first command updates .gha-reversemap.yml with the latest commit hash for the action. The second command propagates this change to all workflow files that reference the action.
To verify that all workflow files use the correct commit hashes:
hack/gha-reversemap.sh verify-mapusage
This command checks all workflow files and reports any discrepancies between the reversemap file and actual workflow references.
Note: CI maintains the fact that hack/gha-reversemap.sh verify-mapusage passes.
Wait until at least a week after that new version was released, to allow time for vulnerabilities to be discovered and reported.
Do a web search on the Action; examine the results to see if any look like reports of a vulnerability.
Consult github.com/advisories about the Action.
If the above turns up a vulnerability, skip this upgrade. Otherwise proceed as follows.
Create a PR to update both the reversemap and the workflow(s). The changes in the PR will be as follows.
hack/gha-reversemap.sh update-action-version to pick up that release. Otherwise edit workflow to reference the tag of the desired release and use hack/gha-reversemap.sh update-reversemap <that workflow>.hack/gha-reversemap.sh apply-reversemap.Get the PR reviewed and merged.
The hack/gha-reversemap.sh script makes calls to the GitHub API, which is rate-limited. If you encounter rate limit errors, you can authenticate using a GitHub token:
export GITHUB_TOKEN=your_token_here
hack/gha-reversemap.sh update-action-version actions/checkout
Authenticated requests have significantly higher rate limits than unauthenticated requests.
Using commit hashes instead of tags provides several security benefits: