You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add GPG and SSH commit signing support (#218)
Add signing inputs and runtime setup for GPG and SSH commit signing in the action container. Extend local image tests and documentation to cover signed commit flows, including passphrase-protected GPG keys and SSH signature verification.
Co-authored-by: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com>
Copy file name to clipboardExpand all lines: README.md
+49Lines changed: 49 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@
9
9
10
10
## ✨ Features
11
11
-**📝 Custom commit messages:** Add custom prefixes and messages to commits
12
+
-**🔏 Commit signing:** Sign generated commits with GPG or SSH keys
12
13
-**🌿 Branch management:** Create new branches automatically with optional timestamps
13
14
-**⏰ Timestamp support:** Add timestamps to branch names for cron-based updates
14
15
-**🔄 Integration-ready:** Works seamlessly with other DevOps workflows
@@ -59,6 +60,9 @@ This action supports three tag levels for flexible versioning:
59
60
amend: false
60
61
commit_prefix: "[AUTO]"
61
62
commit_message: "Automatic commit"
63
+
signing_mode: ""
64
+
signing_key: ""
65
+
signing_passphrase: ""
62
66
force: false
63
67
force_with_lease: false
64
68
no_edit: false
@@ -75,6 +79,9 @@ This action supports three tag levels for flexible versioning:
75
79
| `amend` | No | `false` | Whether to make an amendment to the previous commit (`--amend`). Can be combined with `commit_message` to change the commit message. |
76
80
| `commit_prefix` | No | `""` | Prefix added to commit message. Combines with `commit_message`. |
77
81
| `commit_message` | No | `""` | Commit message to set. Combines with `commit_prefix`. Can be used with `amend` to change the commit message. |
82
+
| `signing_mode` | No | `""` | Commit signing mode. Supported values are `gpg` and `ssh`. Leave empty to disable signing. |
83
+
| `signing_key` | No | `""` | Signing key material. For `gpg`, provide an ASCII-armored private key export. For `ssh`, provide a private key in OpenSSH or PEM format. |
84
+
| `signing_passphrase` | No | `""` | Optional passphrase for the signing key. Passphrase-protected GPG keys are supported. Encrypted SSH signing keys are rejected in the current runtime. |
78
85
| `force` | No | `false` | Whether to use force push (`--force`). Use only when you need to overwrite remote changes. Potentially dangerous. |
79
86
| `force_with_lease` | No | `false` | Whether to use force push with lease (`--force-with-lease`). Safer than `force` as it checks for remote changes. Set `fetch-depth: 0` for `actions/checkout`. |
80
87
| `base_branch` | No | `""` | Base branch used to sync or reset `target_branch`. When empty, the action auto-detects `main`/`master` or origin HEAD. |
@@ -215,6 +222,48 @@ jobs:
215
222
commit_message: "Update README"
216
223
```
217
224
225
+
## 🔏 Commit Signing
226
+
227
+
This action can sign generated commits by configuring repository-local git signing settings at runtime.
228
+
229
+
- `signing_mode: gpg` imports an ASCII-armored private OpenPGP key into an isolated temporary `GNUPGHOME`.
230
+
- `signing_mode: ssh` uses an SSH private key file and git's SSH signing mode.
231
+
- Temporary key material is written outside the repository and removed when the container exits.
232
+
- Passphrase-protected GPG keys are supported through non-interactive loopback pinentry.
233
+
- Encrypted SSH signing keys are currently rejected explicitly instead of falling back to interactive prompts.
234
+
235
+
### 🔐 GPG signing example
236
+
237
+
```yaml
238
+
- name: Commit and push signed changes
239
+
uses: devops-infra/action-commit-push@v1.3.4
240
+
with:
241
+
github_token: ${{ secrets.GITHUB_TOKEN }}
242
+
commit_message: "test(commit-push): signed with gpg"
243
+
signing_mode: gpg
244
+
signing_key: ${{ secrets.GPG_PRIVATE_KEY }}
245
+
signing_passphrase: ${{ secrets.GPG_PASSPHRASE }}
246
+
```
247
+
248
+
### 🔐 SSH signing example
249
+
250
+
```yaml
251
+
- name: Commit and push SSH-signed changes
252
+
uses: devops-infra/action-commit-push@v1.3.4
253
+
with:
254
+
github_token: ${{ secrets.GITHUB_TOKEN }}
255
+
commit_message: "test(commit-push): signed with ssh"
256
+
signing_mode: ssh
257
+
signing_key: ${{ secrets.SSH_SIGNING_KEY }}
258
+
```
259
+
260
+
### 🩺 Signing troubleshooting
261
+
262
+
- `Failed to import GPG signing key`usually means the secret is not an ASCII-armored private key export.
263
+
- `Failed to read SSH signing key`usually means the secret is not a valid private key.
264
+
- `Encrypted SSH signing keys are not supported in this runtime`means the key must be provided without a passphrase.
265
+
- If downstream verification fails, confirm your verifier trusts the matching public key and uses git's corresponding `gpg.format`.
266
+
218
267
## 📝 Amend Options
219
268
When using `amend: true`, you have several options for handling the commit message:
0 commit comments