File tree Expand file tree Collapse file tree 3 files changed +45
-10
lines changed Expand file tree Collapse file tree 3 files changed +45
-10
lines changed Original file line number Diff line number Diff line change 1414 default : ' '
1515 required : false
1616 type : string
17+ sign-commits :
18+ description : ' Enable GPG commit signing'
19+ default : false
20+ required : false
21+ type : boolean
1722
1823 secrets :
1924 NIX_GITHUB_TOKEN :
3136 CREATE_PR_APP_PRIVATE_KEY :
3237 description : Private key of the GitHub App used for opening pull requests.
3338 required : true
39+ GIT_GPG_SIGNING_SECRET_KEY :
40+ description : GPG secret key used to sign commits
41+ required : false
42+ GIT_GPG_SIGNING_PASSPHRASE :
43+ description : GPG passphrase for secret key
44+ required : false
3445
3546 outputs :
3647 pr-url :
6172 trusted-public-keys : ${{ vars.TRUSTED_PUBLIC_KEYS }}
6273 substituters : ${{ vars.SUBSTITUTERS }}
6374
75+ - name : Configure Git credentials
76+ run : |
77+ git config --local user.name "${{ vars.GIT_USER_NAME }}"
78+ git config --local user.email "${{ vars.GIT_USER_EMAIL }}"
79+ git config --local commit.gpgsign ${{ inputs.sign-commits }}
80+
81+ - name : Import GPG key with passphrase
82+ if : ${{ inputs.sign-commits }}
83+ env :
84+ GIT_GPG_SIGNING_SECRET_KEY : ${{ secrets.GIT_GPG_SIGNING_SECRET_KEY }}
85+ GIT_GPG_SIGNING_PASSPHRASE : ${{ secrets.GIT_GPG_SIGNING_PASSPHRASE }}
86+ run : |
87+ echo "$GIT_GPG_SIGNING_SECRET_KEY" \
88+ | gpg --batch --yes \
89+ --pinentry-mode loopback \
90+ --passphrase "$GIT_GPG_SIGNING_PASSPHRASE" \
91+ --import
92+ git config --local user.signingkey "${{ vars.GIT_GPG_SIGNING_KEY_ID }}"
93+
6494 - name : Run `nix flake update`
6595 id : update-lockfile
6696 run : |
Original file line number Diff line number Diff line change 1414 secrets : inherit
1515 with :
1616 runner : ' ["self-hosted", "Linux", "x86-64-v2"]'
17+ sign-commits : true
Original file line number Diff line number Diff line change @@ -4,21 +4,25 @@ set -euo pipefail
44
55FLAKE_INPUT=${FLAKE_INPUT:- " " }
66
7- if ! git config --get user.name > /dev/null 2>&1 || \
8- [ " $( git config --get user.name) " = " " ] ||
9- ! git config --get user.email > /dev/null 2>&1 || \
10- [ " $( git config --get user.email) " = " " ]; then
11- echo " git config user.{name,email} is not set - configuring"
12- set -x
13- git config --local user.email
" [email protected] " 14- git config --local user.name " beep boop"
7+ running_in_github_actions () {
8+ [ -n " $CI " ] && \
9+ [ -n " $GITHUB_REPOSITORY " ] && \
10+ [ -n " $GITHUB_RUN_ID " ] && \
11+ [ -n " $GITHUB_TOKEN " ] && \
12+ curl --silent --fail \
13+ -H " Authorization: Bearer ${GITHUB_TOKEN} " \
14+ -H " Accept: application/vnd.github.v3+json" \
15+ " https://api.github.com/repos/${GITHUB_REPOSITORY} /actions/runs/${GITHUB_RUN_ID} " > /dev/null 2>&1
16+ }
17+
18+ if running_in_github_actions; then
19+ echo " Running in GitHub Actions."
20+ git config --list --show-origin
1521fi
1622
1723current_commit=" $( git rev-parse HEAD) "
1824export PRE_COMMIT_ALLOW_NO_CONFIG=1
1925
20- git config --list --show-origin
21-
2226nix flake update $FLAKE_INPUT --accept-flake-config --commit-lock-file
2327commit_after_update=" $( git rev-parse HEAD) "
2428
You can’t perform that action at this time.
0 commit comments