Pin GitHub Actions to commit SHAs

MSAL

Replaces mutable tag or branch references in GitHub Actions uses: declarations with immutable commit SHAs, using a built-in mapping of well-known actions. The recipe makes no network calls; references not found in the mapping are left unchanged and listed in a data table. By default only third-party actions are pinned; set pinOfficialActions to include actions from the actions and github organizations. To pin only a subset of the mapped actions, set includedActions.

org.openrewrite.github.security.PinGitHubActionsToSha

Optional

pinOfficialActionsBoolean

When set to true, also pins actions from official GitHub organizations (e.g., actions/*, github/*). Defaults to false, meaning only third-party actions are pinned.

Optional list of trusted owners/organizations, actions that belong to these organizations will not be pinned. This option overrides the 'Included actions' list. Separate values with commas.

Optional allow-list of actions to pin. When provided, only uses: references matching one of these patterns are pinned; all other actions are left untouched. Each pattern must match an action in the built-in mapping of known SHAs; it narrows which mapped actions are pinned, and cannot add new ones. Patterns may be owner/repo (exact match), owner/* (any repo in an org), or owner/repo/subpath (exact match including a subpath). When omitted or empty, all third-party actions (and optionally official actions, per pinOfficialActions) are pinned. Separate values with commas.

mod run . --recipe=org.openrewrite.github.security.PinGitHubActionsToSha

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.