Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ✨ gpg sign with passphrase #460

Merged
merged 34 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
027d6e3
feat: :sparkles: (#204) add gnupg to docker image
AndreasAugustin Jan 7, 2024
8915340
feat: :sparkles: (#204) add option to sign commits
AndreasAugustin Jan 7, 2024
97a1e27
fix: :bug: (#204) issue with tty
AndreasAugustin Jan 7, 2024
9621a71
fix: :bug: (#204) fix issue with no tty
AndreasAugustin Jan 7, 2024
f57d687
fix: :bug: (#204) fix issue with no passphrase
AndreasAugustin Jan 7, 2024
20188f4
fix: :bug: (#204) trial
AndreasAugustin Jan 7, 2024
d6fe6df
fix: :bug: (#204) trial for fix
AndreasAugustin Jan 7, 2024
d4dadf0
fix: :bug: (#204) fix
AndreasAugustin Jan 7, 2024
9d35a97
fix: :bug: (#204) trial
AndreasAugustin Jan 7, 2024
0cf0761
fix: :bug: (#204) add pinentry mode loopback
AndreasAugustin Jan 7, 2024
d620612
fix: :bug: (#204)
AndreasAugustin Jan 7, 2024
93fe048
feat: :sparkles: (#204) add signoff and tig
AndreasAugustin Jan 8, 2024
6a81079
fix: :bug: (#204) fix commit
AndreasAugustin Jan 8, 2024
a0821ac
fix: :bug: (#204)
AndreasAugustin Jan 8, 2024
6759d0e
fix: :bug: (#204) trial
AndreasAugustin Jan 8, 2024
c302e72
fix: :bug: (#204)
AndreasAugustin Jan 8, 2024
6ecf2c0
Merge branch 'main' into feat/gpg_sign
AndreasAugustin Jan 18, 2024
9305ea9
Merge branch 'main' into feat/gpg_sign
AndreasAugustin Jan 23, 2024
e2980bd
Merge branch 'main' into feat/gpg_sign
AndreasAugustin Feb 4, 2024
856280c
Merge branch 'main' into feat/gpg_sign
AndreasAugustin Feb 5, 2024
3b9a839
fix: :bug: trial for gpg sign
AndreasAugustin Feb 5, 2024
2d4cee9
fix: :construction: wip
AndreasAugustin Feb 5, 2024
6c8e1be
fix: :construction: WIP
AndreasAugustin Feb 5, 2024
739dc19
fix: :construction: WIP
AndreasAugustin Feb 6, 2024
cea65b0
Merge branch 'main' into feat/gpg_sign
AndreasAugustin Feb 16, 2024
1dd7023
Merge branch 'main' into feat/gpg_sign
AndreasAugustin Feb 21, 2024
752104a
Merge branch 'main' into feat/gpg_sign_pwd
AndreasAugustin Feb 22, 2024
cbc5913
Merge branch 'main' into feat/gpg_sign_pwd
AndreasAugustin Feb 22, 2024
e28f14d
Merge branch 'main' into feat/gpg_sign_pwd
AndreasAugustin Feb 29, 2024
21ac0d2
Merge branch 'main' into feat/gpg_sign_pwd
AndreasAugustin Mar 5, 2024
cbb8538
Merge branch 'main' into feat/gpg_sign_pwd
AndreasAugustin Mar 5, 2024
46e7ec9
Merge branch 'main' into feat/gpg_sign_pwd
AndreasAugustin Mar 11, 2024
b730301
fix: :bug:
AndreasAugustin Mar 11, 2024
e630d9e
fix: :bug:
AndreasAugustin Mar 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ jobs:
| git_user_email | `[optional]` set the committer git user.email | `false` | `github-action@actions-template-sync.noreply.${SOURCE_REPO_HOSTNAME}` |
| git_remote_pull_params | `[optional]` set remote pull parameters | `false` | `--allow-unrelated-histories --squash --strategy=recursive -X theirs` |
| gpg_private_key | `[optional]` set if you want to sign commits | `false` | |
| gpg_passphrase | `[optional]` set if your optionial gpg private key has a passphrase | `false` | |

### Action Outputs

Expand Down Expand Up @@ -332,7 +333,7 @@ gpg --armor --export-secret-key jon@doe.example | xclip

:warning: the gpg username and email must match the `git_user_name` and `git_user_email` parameters.
Paste your clipboard as a [secret][github-create-secret] named `GPG_PRIVATE_KEY` for example.
:warning: currently a pgp key with passphrase is not supported (yet).
If your key has a password, create another secret named `GPG_PASSPHRASE`.

```yaml
# File: .github/workflows/template-sync.yml
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ inputs:
description: "[optional] set the pull parameters for the remote repository"
gpg_private_key:
description: "[optional] set the gpg private key if you want to sign your commits"
gpg_passphrase:
description: "[optional] set if your private gpg key has a password"
runs:
using: "docker"
image: "src/Dockerfile"
Expand All @@ -84,3 +86,4 @@ runs:
GIT_USER_EMAIL: ${{ inputs.git_user_email }}
GIT_REMOTE_PULL_PARAMS: ${{ inputs.git_remote_pull_params }}
GPG_PRIVATE_KEY: ${{ inputs.gpg_private_key }}
GPG_PASSPHRASE: ${{ inputs.gpg_passphrase }}
4 changes: 1 addition & 3 deletions src/gpg_no_tty.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/usr/bin/env bash

if [[ -n "${GPG_PASSPHRASE}" ]] &>/dev/null; then
# echo -e "${GPG_PASSPHRASE}" | gpg --pinentry-mode loopback --batch --yes --passphrase-fd 0 "$@" <&0
echo "::error::currently gpg with passphrase is not supported"
exit 1
gpg --pinentry-mode loopback --batch --yes --passphrase "${GPG_PASSPHRASE}" "$@" <&0
else
gpg --pinentry-mode loopback --yes --batch "$@" <&0
fi
Expand Down
2 changes: 1 addition & 1 deletion src/sync_template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ function handle_templatesyncignore() {

function prechecks() {
info "prechecks"
echo "::group::force file deletion"
echo "::group::prechecks"
check_branch_remote_existing "${NEW_BRANCH}"

check_if_commit_already_in_hist_graceful_exit "${TEMPLATE_REMOTE_GIT_HASH}"
Expand Down