ci: pin star-history workflow actions to commit SHAs and scope its token - #56
Open
Chirag6722 wants to merge 1 commit into
Open
ci: pin star-history workflow actions to commit SHAs and scope its token#56Chirag6722 wants to merge 1 commit into
Chirag6722 wants to merge 1 commit into
Conversation
The scheduled workflow ran narayann7/star-history-action@main, a mutable branch reference, while holding a workflow-wide contents: write token. A composite action's steps execute in this repository's runner, so whatever sat on that branch at 00:17 UTC each day ran with permission to push to main. - Pin both actions to full commit SHAs (checkout v5.0.0, star-history v1.0.5) with the version in a trailing comment. - Add .github/dependabot.yml for the github-actions ecosystem so the pinned SHAs still get updated. - Default the workflow to contents: read and grant write only on the job that pushes. - Drop the manual commit/push step: the action already commits and rebases before pushing, while this step pushed without a rebase and would fail on a non-fast-forward. - Add a concurrency group so a manual run cannot race the scheduled one. Closes Seeed-Projects#55 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #55
What this changes
.github/workflows/star-history.ymlrannarayann7/star-history-action@main— a mutable branch reference — while holding a workflow-widecontents: writetoken. Because that action is a composite action, its steps (npm ci,render-charts.sh,readme-embed.py) execute inside this repository's runner. Whatever sat on that upstream branch at 00:17 UTC each day ran with permission to push tomainof this repo.actions/checkout@v4(mutable tag)@08c6903…(v5.0.0)narayann7/star-history-action@main(mutable branch)@a68d8f9…(v1.0.5)permissionscontents: writecontents: read, job-levelcontents: writegroup: star-historygithub-actions, weekly)Why the manual commit step is removed, not kept
star-history-actionalready commits and pushes by default (commit: true), and its push doesgit pull --rebase origin "$branch"first. The workflow's own step re-implemented that without the rebase:Today it is a no-op — the action has already committed, so
git commitfinds nothing staged and|| exit 0swallows it. That is visible in the run history: every recent scheduled run landed a commit titledchore: update star history [skip ci], which is the action's default message, not this step's. So the step contributes nothing and its only possible effect is a non-fast-forward failure when something lands onmainmid-run. The newconcurrencygroup closes the other half of that race.Why Dependabot is part of this
Pinning to a SHA without automated bumps trades a supply-chain risk for a staleness risk — the pin silently ages out of upstream security fixes.
.github/dependabot.ymlreads the# v1.0.5trailing comments and opens a PR when a newer release ships, which is what makes SHA pinning maintainable.Verification
actionlint(v1.7.12) passes on the new workflow — exit 0, no findings.uses:pins were asserted programmatically after the edit.a68d8f9d67ca20d55b682a264e69152dcf326e9cis the commit behind the annotated tagv1.0.5, and08c6903cd8c0fde910a37f88322edcfb5dd907a8isactions/checkoutv5.0.0.readme-embed.pyat the pinned SHA exits 0 with"star-history markers not found in README; skipping update"when the marker comments are absent, so pinning does not change how this repo's hand-written<picture>block is treated.Not verified by a live run: I could not dispatch the workflow from my fork — GitHub does not register workflows on a fresh fork without enabling them through the Actions UI, so
workflow_dispatchreturns 404 there. The behavioural change is confined to removing a step that provably does nothing today; a maintainer can confirm with one manualworkflow_dispatchon this branch before merging.🤖 Generated with Claude Code