Add automated GPG signing for modified files on PRs#2
Draft
Conversation
Agent-Logs-Url: https://github.com/abooker30126/devsecops/sessions/2b123171-3b19-416d-a90f-5f48f86eda92 Co-authored-by: abooker30126 <31778876+abooker30126@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement cryptographic GPG signing for code files
Add automated GPG signing for modified files on PRs
Apr 18, 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.
Adds cryptographic GPG signing infrastructure so that
.sh,.py,.yml/.yaml, and.tffiles are automatically signed whenever they are modified in a pull request.New files
.github/workflows/gpg-sign-files.yml— Triggers on PRopened/synchronize/reopened; diffsbase..headto identify modified target files; signs each with a detached ASCII-armored GPG signature; commits*.gpg.sigfiles back to the PR branch ([skip ci]); posts a signed-files summary comment..github/scripts/sign-files.sh— Signs a single file viagpg --detach-sign --armor, respects.gpg-ignoreexclusions, passes the passphrase through--passphrase-fd 0, and verifies the produced signature before exiting..github/scripts/setup-gpg.sh— Local helper: imports a key, configuresgitcommit/tag signing, and exports the public key togpg-public-key.asc..github/SECURITY_KEYS.md— Documents key generation, GitHub Secrets setup, and single-file / bulk verification..gpg-ignore— Glob exclusion list (vendored deps, compiled output,.terraform/,.tfstate, secrets files).Required secrets
Two repository secrets must be added under Settings → Secrets and variables → Actions before the workflow can run:
GPG_PRIVATE_KEYgpg --armor --export-secret-keys <KEY_ID>GPG_PASSPHRASEVerification
Original prompt
Overview
Implement cryptographic GPG signing for code files across the repository with automated signing workflows for pull requests.
Requirements
Implementation Details
Files to Create:
.github/workflows/gpg-sign-files.yml - Main workflow that:
.github/scripts/sign-files.sh - Script that:
.gpg.sigformat.github/scripts/setup-gpg.sh - Local setup script:
.github/SECURITY_KEYS.md - Documentation:
.gpg-ignore - Configuration file:
GitHub Secrets Required
GPG_PRIVATE_KEY- Exported private GPG keyGPG_PASSPHRASE- GPG key passphraseWorkflow Behavior
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: go through each of my repos and for each file add the gpg signature + add logic to each repo that updates the gpg signature for each file in a PR
Assistant: I need to clarify your request before proceeding. You want me to:
I have a few questions to help me understand the scope and implementation:
Which repositories? Should I:
abooker30126/devops-intro-project?GPG signature implementation details:
.sh,.py,.yml)?PR logic for updating signatures:
Scope of files:
Could you provide more details on these points so I can create the right solution for you?
User: all repositories in account and specific file types (e.g., .sh, .py, .yml, .tf) + actual cryptographic GPG signatures + When a PR is created/updated, a GitHub Actions workflow automatically signs only modified files
Assistant: I'll help you set this up. Let me start by discovering all your repositories and then create a solution for adding GPG signatures and automating the process with GitHub Actions.
Assistant: I found 7 repositories in your account. Now I'll create a comprehensive solution that:
Let me create the PR with these components for your primary repository (
devops-intro-project), which you can then replicate to the others:Assistant: I've started creating the GPG signing workflow for your first repository. Now I'll create the same setup across all your other repositories. Let me continue with the remaining repositories:
Assistant: Perfect! I'm waiting for your confirmation to proceed with creating the GPG signing implementation across all your repositories. Please approve the pull requests that will be generated, or let me know if you'd like to adjust the approach.
User: tonybooker@iMac ~ gpg --list-secret-keys --keyid-format=long
gpg: checking the trustdb
gpg: marginals needed: 3 completes needed: 1 trust model: pgp
gpg: depth: 0 valid: 3 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 3u
/Users/tonybooker/.gnupg/pubring.kbx
----------------------...
This pull request was created from Copilot chat.