fix: sign semantic-release commits#2230
Merged
Merged
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideConfigures semantic-release workflow to sign commits and tags using an SSH-based GPG signing key and a dedicated bot identity, replacing the previous unsigned semantic-release identity configuration. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- Prefer using repository-local Git config (
git config user.*/--local) instead of--globalinside the workflow so the settings don’t leak between jobs or affect other checkouts on the same runner. - Consider deleting the
~/.ssh/signing_keyfile at the end of the job (or using a temporary directory under$RUNNER_TEMP) to reduce the lifetime of the private key material on the runner filesystem.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Prefer using repository-local Git config (`git config user.*` / `--local`) instead of `--global` inside the workflow so the settings don’t leak between jobs or affect other checkouts on the same runner.
- Consider deleting the `~/.ssh/signing_key` file at the end of the job (or using a temporary directory under `$RUNNER_TEMP`) to reduce the lifetime of the private key material on the runner filesystem.
## Individual Comments
### Comment 1
<location path=".github/workflows/semantic-release.yml" line_range="22-23" />
<code_context>
with:
token: "${{ steps.app-token.outputs.token }}"
+ - name: Configure SSH commit signing
+ env:
+ SIGNING_KEY: ${{ secrets.SEMANTIC_RELEASE_SIGNING_KEY }}
+ run: |
+ mkdir -p ~/.ssh
</code_context>
<issue_to_address>
**issue:** Handle the case where the signing key secret is missing or empty to avoid failing commits.
With a missing or empty `SEMANTIC_RELEASE_SIGNING_KEY`, this still enables `commit.gpgSign`/`tag.gpgSign` but writes an empty key file, causing later `git commit`/`git tag` to fail in a confusing way. Consider either skipping this step when `secrets.SEMANTIC_RELEASE_SIGNING_KEY == ''` or failing fast with an explicit error if the secret is not set.
</issue_to_address>
### Comment 2
<location path=".github/workflows/semantic-release.yml" line_range="26" />
<code_context>
+ SIGNING_KEY: ${{ secrets.SEMANTIC_RELEASE_SIGNING_KEY }}
+ run: |
+ mkdir -p ~/.ssh
+ echo "$SIGNING_KEY" > ~/.ssh/signing_key
+ chmod 600 ~/.ssh/signing_key
+ git config --global gpg.format ssh
</code_context>
<issue_to_address>
**🚨 suggestion (security):** Consider cleaning up the signing key file after use to reduce exposure of the private key on the runner.
Even on an ephemeral runner, the key stays on disk at `~/.ssh/signing_key` for the remainder of the job. As defense in depth, you could delete it after the last signed operation, for example:
```sh
shred -u ~/.ssh/signing_key || rm -f ~/.ssh/signing_key
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2230 +/- ##
=======================================
Coverage 58.46% 58.46%
=======================================
Files 139 139
Lines 8925 8925
=======================================
Hits 5218 5218
Misses 3159 3159
Partials 548 548
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
TenSt
approved these changes
Jun 9, 2026
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.
Secure Coding Practices Checklist GitHub Link
Secure Coding Checklist
Summary by Sourcery
Build: