Skip to content

ci: sign commits in bump_version workflow [SEC-2166]#116

Open
leifdreizler wants to merge 4 commits intodevelopfrom
sign-bump-version
Open

ci: sign commits in bump_version workflow [SEC-2166]#116
leifdreizler wants to merge 4 commits intodevelopfrom
sign-bump-version

Conversation

@leifdreizler
Copy link
Copy Markdown

@leifdreizler leifdreizler commented May 8, 2026

Summary

Makes the bump_version workflow produce signed commits

  • Sign the bump commit. Replace local git commit -am (unsigned, the cause of the "Require Signed Commits" Fails in Rule Insights) with peter-evans/create-pull-request@v8.1.1
  • Collapse PR creation. peter-evans handles opening the PR, so the manual gh pr create step and the unreachable gh pr list | grep "PR exists" guard are gone.
  • Tag via API. Switch tag creation to gh api .../git/refs against pull-request-head-sha from peter-evans, since local HEAD doesn't advance after an API commit. Result is the same lightweight tag as before.
  • Modernize token minting. Replace the bespoke JWT + curl block with actions/create-github-app-token@v3.1.1
  • Drop unused permissions. permissions: {} since the workflow no longer touches secrets.GITHUB_TOKEN.

Testing

This run successfully opened this PR. Tagging correctly skipped for existing version on this run.

🤖 Generated with Claude Code

leifdreizler and others added 2 commits May 8, 2026 13:10
Switches token minting to actions/create-github-app-token@v3.1.1 (pinned
by SHA), uses SEMGREP_CI_CLIENT_ID, scopes the token to this repo via
`repositories:`, and drops the now-unused permissions block since the
workflow no longer relies on secrets.GITHUB_TOKEN.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces local `git commit -am` (unsigned) with peter-evans/create-pull-request
using `sign-commits: true`, which creates the commit through the GitHub
Contents API so the App installation token signs it. Also collapses the
manual `gh pr create` step (peter-evans handles PR creation) and switches
the tag to `gh api .../git/refs`, pointing at the new commit SHA returned
by peter-evans rather than the now-stale local HEAD.

Pins actions/checkout to v6.0.2 by SHA and drops its write token in favor
of `persist-credentials: false` since nothing pushes via local git anymore.
Normalizes input access on `inputs.*`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
SHA: ${{ steps.cpr.outputs.pull-request-head-sha }}
run: |
# check if the branch already has a pull request open
if gh pr list --head ${SOURCE} | grep -vq "no pull requests"; then
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if gh pr list --head ${SOURCE} won't happen in practice because SOURCE contains a unique github.run_id

app-id is deprecated in v3.1.1 with a "Use 'client-id' instead"
deprecation message. The secret is already SEMGREP_CI_CLIENT_ID,
so swap the input name to match.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@leifdreizler leifdreizler marked this pull request as ready for review May 8, 2026 20:54
When the dispatched version is already on develop, bump-version.sh is
a no-op and peter-evans sets pull-request-operation=none with
pull-request-head-sha pointing at develop's existing HEAD. The tag
step then tried to create refs/tags/vX.Y.Z at that already-tagged
commit and failed with 422 "Reference already exists". Gate the tag
step on a PR actually being created/updated so no-op dispatches
exit cleanly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
token: ${{ steps.token.outputs.token }}
persist-credentials: false
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to persist-credentials now that there aren't any local git commands

private-key: ${{ secrets.SEMGREP_CI_APP_KEY }}
repositories: pre-commit

- uses: actions/checkout@v4
Copy link
Copy Markdown
Author

@leifdreizler leifdreizler May 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v4 runs on Node 20, which is getting support dropped later this year

@leifdreizler leifdreizler changed the title ci: sign commits in bump_version workflow ci: sign commits in bump_version workflow [SEC-2166] May 8, 2026
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.

1 participant