| name | pin-github-actions |
| description | Run when adding or updating GitHub Actions workflow steps. Pin every action to a commit SHA with the resolved version tag as a trailing comment. |
Pin GitHub Actions
Every uses: step in a workflow must reference an exact commit SHA, not a tag or branch.
Append the resolved version tag as a trailing comment so the intent is clear.
Format:
uses: owner/action@<commit-sha>
Example:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
Resolving the SHA
Given a tag like v4:
git ls-remote https://github.com/<owner>/<action>.git "refs/tags/v4" "refs/tags/v4^{}"
git ls-remote https://github.com/<owner>/<action>.git "refs/tags/v4.*"
Rules
- Never reference a mutable tag (e.g.,
@v4, @main).
- Never omit the version comment — it is the only human-readable clue to the pinned version.
- Dependabot keeps SHAs current; do not manually update SHAs unless Dependabot cannot reach the action.
- Internal workflow references (
uses: ./.github/workflows/...) are exempt.