fix: sign semantic-release commits#2380
Merged
jdobes merged 1 commit intoJun 5, 2026
Merged
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideConfigures semantic-release workflow to sign commits and tags using an SSH GPG key stored in GitHub secrets. Sequence diagram for semantic-release signed commits configurationsequenceDiagram
participant GitHubActionsRunner as GitHubActionsRunner
participant GitConfig as git
participant GitHubSecrets as GitHubSecrets
participant SemanticRelease as semantic-release
GitHubActionsRunner->>GitHubSecrets: read SEMANTIC_RELEASE_SIGNING_KEY
GitHubActionsRunner->>GitConfig: git config gpg.format ssh
GitHubActionsRunner->>GitConfig: git config user.signingkey ~/.ssh/signing_key
GitHubActionsRunner->>GitConfig: git config commit.gpgSign true
GitHubActionsRunner->>GitConfig: git config tag.gpgSign true
GitHubActionsRunner->>SemanticRelease: run semantic-release
SemanticRelease->>GitConfig: create signed commits and tags
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 1 issue, and left some high level feedback:
- Consider configuring commit signing at the repository level (e.g.,
git config user.signingkey ...) instead of using--global, so the runner’s global Git config isn’t modified in ways that could affect other jobs on the same runner. - It may be worth guarding the signing configuration step with a condition (e.g., checking that
secrets.SEMANTIC_RELEASE_SIGNING_KEYis set) to avoid the workflow failing unexpectedly when the secret is not available in a given environment.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider configuring commit signing at the repository level (e.g., `git config user.signingkey ...`) instead of using `--global`, so the runner’s global Git config isn’t modified in ways that could affect other jobs on the same runner.
- It may be worth guarding the signing configuration step with a condition (e.g., checking that `secrets.SEMANTIC_RELEASE_SIGNING_KEY` is set) to avoid the workflow failing unexpectedly when the secret is not available in a given environment.
## Individual Comments
### Comment 1
<location path=".github/workflows/semantic-release.yml" line_range="30-35" />
<code_context>
with:
fetch-depth: 0
persist-credentials: false # The auth token is persisted in the local git config. semantic-release picks this one instead of GH_TOKEN
+ - name: Configure SSH commit signing
+ env:
+ 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>
**issue (bug_risk):** Guard against missing or empty SIGNING_KEY to avoid confusing runtime behavior.
If `SEMANTIC_RELEASE_SIGNING_KEY` is unset or empty, this step still writes an empty `signing_key` file, causing opaque signing failures later. Please add a guard (e.g., `test -n "$SIGNING_KEY" || { echo "SIGNING_KEY missing" >&2; exit 1; }`) so the workflow fails fast with a clear error when the secret is misconfigured.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
MichaelMraka
approved these changes
Jun 5, 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: