Skip to content

fix: sign semantic-release commits#2230

Merged
MichaelMraka merged 1 commit into
RedHatInsights:masterfrom
MichaelMraka:pr2
Jun 10, 2026
Merged

fix: sign semantic-release commits#2230
MichaelMraka merged 1 commit into
RedHatInsights:masterfrom
MichaelMraka:pr2

Conversation

@MichaelMraka

@MichaelMraka MichaelMraka commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Secure Coding Practices Checklist GitHub Link

Secure Coding Checklist

  • Input Validation
  • Output Encoding
  • Authentication and Password Management
  • Session Management
  • Access Control
  • Cryptographic Practices
  • Error Handling and Logging
  • Data Protection
  • Communication Security
  • System Configuration
  • Database Security
  • File Management
  • Memory Management
  • General Coding Practices

Summary by Sourcery

Build:

  • Configure semantic-release GitHub Actions workflow to use an SSH-based signing key and GPG-style settings for commits and tags.

@MichaelMraka MichaelMraka requested a review from a team as a code owner June 9, 2026 09:31
@sourcery-ai

sourcery-ai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Configures 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

Change Details Files
Enable SSH-based GPG signing for semantic-release commits and tags in the GitHub Actions workflow.
  • Add a step before the release commit to configure SSH commit signing using a private key provided via the SEMANTIC_RELEASE_SIGNING_KEY secret
  • Create and secure an SSH key file in the runner home directory and configure git to use gpg.format=ssh and user.signingkey pointing to that key
  • Globally enable GPG signing for commits and tags in the workflow and set the git user name/email to the vmaas-bot identity
  • Remove the old per-step git user.name and user.email configuration for semantic-release in favor of the new global bot identity
.github/workflows/semantic-release.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 2 issues, and left some high level feedback:

  • 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.
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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .github/workflows/semantic-release.yml
Comment thread .github/workflows/semantic-release.yml
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.46%. Comparing base (cf25d8a) to head (0a7079a).

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           
Flag Coverage Δ
unittests 58.46% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TenSt TenSt self-assigned this Jun 9, 2026
@MichaelMraka MichaelMraka merged commit b6f1ae3 into RedHatInsights:master Jun 10, 2026
8 checks passed
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.

3 participants