WorkingDirectory icon
Clone icon
Script icon
Get icon
If icon
SlackIncomingWebhook icon
Set icon
Schedule icon

Find GitHub Actions Not Pinned to a Commit SHA and Get the Pinned Lines in Slack

Find GitHub Actions steps that use third-party actions by tag instead of commit SHA, resolve each tag and post the pinned replacement lines to Slack.

Categories
Infrastructure

A tag like some-org/some-action@v4 can be moved to different code at any time, which is how the 2025 tj-actions/changed-files compromise reached thousands of CI pipelines. GitHub's security hardening guide recommends pinning third-party actions to a full-length commit SHA. This blueprint audits a repository for references that are not pinned, resolves the commit each one points to today, and posts the replacement line, ready to paste, to Slack.

How it works

  1. audit (WorkingDirectory) runs clone, a shallow checkout of the branch, and find_unpinned, which reads every uses: line in .github/workflows/*.yml and in composite action.yml files. Local actions (./...), actions from trusted_owners and references already pinned to a 40-character SHA are skipped. docker:// images without an @sha256: digest are reported too.
  2. load_known reads the findings already reported for this repository from the KV store.
  3. resolve_shas asks the GitHub API which commit each tag or branch points to and builds lines such as uses: owner/action@<sha> # v4. It writes them all to pin-suggestions.txt and keeps only findings that were not reported before.
  4. if_new_findings posts the new findings to Slack.
  5. remember_findings stores the current findings, so fixed references drop out.

Prerequisites

  • A Slack Incoming Webhook.
  • A GitHub token to resolve tags through the GitHub API (5,000 requests per hour). A fine-grained token with no permissions is enough for public actions; private actions need Contents: Read on their repositories.

Secrets

  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL for findings and failures.
  • GITHUB_TOKEN: GitHub token used by resolve_shas to resolve tags to commits.

In the open-source edition, secrets are environment variables on the Kestra container, prefixed with SECRET_ and base64-encoded. See how to manage secrets.

Inputs

  • git_url (STRING) and branch (STRING): the repository to audit.
  • trusted_owners (JSON, default ["actions", "github"]): owners allowed to stay on tags. Add your own organization, or use [] for a strict policy.

Quick start

  1. Add the two secrets and point git_url at your repository.
  2. Execute the flow. Every unpinned reference is posted once, and pin-suggestions.txt holds the full list of replacements.
  3. Apply the replacements (or let Dependabot or Renovate keep the SHAs current afterwards) and execute it again: nothing is posted unless a new unpinned reference appears.
  4. Enable daily. To audit several repositories, add one Schedule trigger per repository with its own inputs.

Outputs

  • {{ outputs.resolve_shas.outputFiles['pin-suggestions.txt'] }}: every finding with its pinned replacement.
  • {{ outputs.resolve_shas.vars.fresh }}: findings not reported before.
  • KV entry unpinned_actions_<repository>: the findings at the last run.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.