Skip to content

Pin GitHub Actions to commit SHAs and move GHCR login - #136

Merged
plainprogrammer merged 4 commits into
mainfrom
claude/charming-dirac-h4g2fz
Oct 26, 2026
Merged

plainprogrammer merged 4 commits into
mainfrom
claude/charming-dirac-h4g2fz

Conversation

@plainprogrammer

Copy link
Copy Markdown
Owner

Summary

This PR pins all GitHub Actions to full commit SHAs with version comments for security and reproducibility, and reorganizes the GHCR login step to run only just before the push to minimize token exposure on disk.

Key Changes

  • Action pinning: All uses: statements in ci.yml and ghcr-cleanup.yml now reference full commit SHAs with trailing version comments (e.g., actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1). This applies to:

    • actions/checkout (v7.0.1)
    • ruby/setup-ruby (v1.99.0)
    • actions/upload-artifact (v7.0.2)
    • actions/download-artifact (v8.0.2)
    • docker/setup-buildx-action (v4.4.1)
    • docker/login-action (v4.7.0)
    • docker/metadata-action (v6.2.0)
    • docker/build-push-action (v7.4.0)
  • GHCR login repositioning: Moved the "Log in to GHCR" step in the image job from before the Ruby setup to immediately before "Push by digest". This ensures the GITHUB_TOKEN is only on disk during the actual push operation, reducing the window of exposure (addresses issue Pin GitHub Actions to commit SHAs and let Dependabot update them #132).

  • Comment cleanup: Removed outdated comment about pinning being issue Pin GitHub Actions to commit SHAs and let Dependabot update them #132; replaced with a new comment explaining the login timing rationale.

  • Documentation update: Added a new bullet point to docs/architecture/release-and-deploy.md documenting the action pinning strategy and Dependabot's role in keeping pins current, plus the login timing security measure.

  • Test fix: Added a skip condition in spec/lib/collector/worktree_setup_spec.rb to skip the git config write failure test when running as root (UID 0), since root can write to read-only paths.

Implementation Details

  • Dependabot's github-actions configuration will automatically update these pinned SHAs as new versions are released, keeping the pins current while maintaining the security benefits of SHA pinning.
  • The login step now includes a comment explaining why it runs last: "only the push needs the token, so no other action or test runs with it on disk".
  • All pins follow the format: action@<full-sha> # <version-tag> for clarity and auditability.

https://claude.ai/code/session_01Gkfhd3fVMpCfVyUucgdG37

…the push

Every action in ci.yml and ghcr-cleanup.yml is pinned to a full commit SHA
with its version in a comment (Dependabot's github-actions ecosystem was
already configured and updates the pins). ruby/setup-ruby@v1 was a moving
branch; it is pinned to v1.99.0. The image job's GHCR login moves to just
before "Push by digest", so no other step runs with the token on disk.

Refs #132

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gkfhd3fVMpCfVyUucgdG37
Root ignores directory permissions, so the example's read-only .git never
makes the write fail. Same guard as the backup restore spec uses.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gkfhd3fVMpCfVyUucgdG37
@plainprogrammer plainprogrammer self-assigned this Oct 25, 2026
…-h4g2fz

# Conflicts:
#	spec/lib/collector/worktree_setup_spec.rb
v1.99.0 predates Ruby 4.0 and failed with "Unknown version 4.0.7". v1.335.0
is the latest release and the head of the v1 branch the workflows used
before pinning, so behaviour is unchanged.

Refs #132

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gkfhd3fVMpCfVyUucgdG37
@plainprogrammer
plainprogrammer merged commit 054a8c2 into main Oct 26, 2026
4 checks passed
@plainprogrammer
plainprogrammer deleted the claude/charming-dirac-h4g2fz branch October 26, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants