-
Notifications
You must be signed in to change notification settings - Fork 249
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
add git commit signing #127
Conversation
🦋 Changeset detectedLatest commit: 744ef55 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
src/gitUtils.ts
Outdated
"gnupg", | ||
]); | ||
await exec("gpg", ["--import"], { input: Buffer.from(gpgPrivateKey) }); | ||
const { stdout: keyId } = await execWithOutput(`/bin/bash -c "gpg --list-secret-keys --with-colons | grep '^sec:' | cut -d ':' -f 5"`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couldnt this be decoded from the importing's command output? something like this should display the information about what is being imported
gpg --with-colons --import-options show-only --import
the problem with listing all keys is that potentially the returned list could potentially contain many entries and we could grab some unrelated keyId
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah true, although the current implementation seems to be sufficient for the crowdin action, especially if consumers are just passing the one private key.
Happy to explore your solution though if this is a blocker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a blocker per se but if this solution could be used then I would prefer using it - cause it seems to be more explicit about the whole flow. It's less dependent on other factors and the preexisting environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that makes sense, I won't pick this up for a few days now but I've addressed all the other comments, if it's sufficient as is then feel free to merge but if not I'll come back to this
Could we just have an option to disable setting the git email and name and then you can setup the signing before the Changesets action runs? It seems strange to have this built-in to the Changesets action. |
@mitchellhamilton yeah that's valid, I'm happy to open up a new PR with that approach if you prefer. The current implementation is based on the Crowdin action, so it's up to you whether you'd like to align with that or if you'd rather have the action assume the git user is set up. |
@mitchellhamilton here's another PR with the solution you suggested Let me know which approach you both prefer |
Closing in favour of #131 |
Context
Fixes #126
Changes
githubUserName
input option"github-actions[bot]"
githubUserEmail
input option"github-actions[bot]@users.noreply.github.com"
GPG_PRIVATE_KEY
env optiongithubUserName
andgithubUserEmail
tosetupUser
setupCommitSigning
ifGPG_PRIVATE_KEY
is presentgpg
STDIN
forgpg --import
(utf-8 encoding withBuffer.from
by default)/bin/bash
command to get and grep the key id -exec
doesn't support piping and multiple commands on its owngit
config foruser.signingkey
andcommit.gpgsign
Considerations
githubUserName
vsgithub_user_name
)env
variables instead?]gpg
here?