-
Notifications
You must be signed in to change notification settings - Fork 42
feat: support commit sign without GPG #200
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -42,7 +42,6 @@ inputs: | |||||
| GitHub Actions will not run workflows on pull requests which are opened by a GitHub Action. | ||||||
|
|
||||||
| **To run GitHub Actions workflows on this PR, close and re-open this pull request.** | ||||||
|
|
||||||
| pr-labels: | ||||||
| description: "A comma or newline separated list of labels to set on the Pull Request to be created" | ||||||
| required: false | ||||||
|
|
@@ -72,7 +71,9 @@ inputs: | |||||
| required: false | ||||||
| default: "github-actions[bot]@users.noreply.github.com" | ||||||
| sign-commits: | ||||||
| description: "Set to true if the action should sign the commit with GPG" | ||||||
| description: "Set to true if the action should sign the commit" | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
or something, to make it more explicit that it should only be set in case you want the commit signed by the token and not by GPG, etc |
||||||
| required: false | ||||||
| default: "false" | ||||||
| required: false | ||||||
| default: "false" | ||||||
| gpg-private-key: | ||||||
|
|
@@ -108,7 +109,7 @@ runs: | |||||
| using: "composite" | ||||||
| steps: | ||||||
| - name: Import bot's GPG key for signing commits | ||||||
| if: ${{ inputs.sign-commits == 'true' }} | ||||||
| if: ${{ inputs.gpg-private-key != '' }} | ||||||
| id: import-gpg | ||||||
| uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec # v6.3.0 | ||||||
| with: | ||||||
|
|
@@ -118,8 +119,8 @@ runs: | |||||
| git_config_global: true | ||||||
| git_user_signingkey: true | ||||||
| git_commit_gpgsign: true | ||||||
| - name: Set environment variables (signed commits) | ||||||
| if: ${{ inputs.sign-commits == 'true' }} | ||||||
| - name: Set environment variables (signed commits with GPG) | ||||||
| if: ${{ inputs.gpg-private-key != '' }} | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And we don't do this for both cases because create-pull-request handles it for us, I assume? |
||||||
| shell: bash | ||||||
| env: | ||||||
| GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }} | ||||||
|
|
@@ -133,7 +134,7 @@ runs: | |||||
| echo "GIT_COMMITTER_NAME=$GIT_COMMITTER_NAME" >> $GITHUB_ENV | ||||||
| echo "GIT_COMMITTER_EMAIL=<$GIT_COMMITTER_EMAIL>" >> $GITHUB_ENV | ||||||
| - name: Set environment variables (unsigned commits) | ||||||
| if: ${{ inputs.sign-commits != 'true' }} | ||||||
| if: ${{ inputs.gpg-private-key == '' && inputs.sign-commits != 'true' }} | ||||||
| shell: bash | ||||||
| run: | | ||||||
| echo "GIT_AUTHOR_NAME=${{ inputs.git-author-name }}" >> $GITHUB_ENV | ||||||
|
|
@@ -202,7 +203,7 @@ runs: | |||||
| run: rm -f pr_body.txt pr_body.template | ||||||
| - name: Create PR | ||||||
| id: create-pr | ||||||
| uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5 | ||||||
| uses: peter-evans/create-pull-request@v7 | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you could go back to using the revision associated with the tag at this point in time, that would be swell. |
||||||
| with: | ||||||
| base: ${{ inputs.base }} | ||||||
| branch: ${{ inputs.branch }} | ||||||
|
|
@@ -215,3 +216,4 @@ runs: | |||||
| labels: ${{ inputs.pr-labels }} | ||||||
| reviewers: ${{ inputs.pr-reviewers }} | ||||||
| body: ${{ steps.pr_body.outputs.content }} | ||||||
| sign-commits: ${{ inputs.sign-commits }} | ||||||
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.
Should probably update this example to remove
sign-commitsso that it's not trying to sign with both the token and GPG?In fact, we should probably make that an error: specifying both
sign-commitsas well asgpg-private-key.