99permissions :
1010 contents : write
1111 pull-requests : write
12+ id-token : write
1213
1314jobs :
1415 update-gomod2nix :
2223 repository : ${{ github.event.pull_request.head.repo.full_name }}
2324 ref : ${{ github.event.pull_request.head.ref }}
2425 token : ${{ secrets.GITHUB_TOKEN }}
25-
26+ persist-credentials : false
27+
28+ - name : Configure Git for GitHub Verified Commit
29+ run : |
30+ git config user.name "dependabot[bot]"
31+ git config user.email "49699333+dependabot[bot]@users.noreply.github.com"
32+ git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
33+
2634 - name : Install Nix
2735 uses : cachix/install-nix-action@v31
2836 with :
@@ -42,22 +50,26 @@ jobs:
4250 echo "changed=true" >> $GITHUB_OUTPUT
4351 fi
4452
53+
4554 - name : Commit and push gomod2nix.toml
4655 if : steps.changes.outputs.changed == 'true'
47- uses : EndBug/add-and-commit@v9
48- with :
49- default_author : github_actions
50- message : " chore: update gomod2nix.toml"
51- add : ' gomod2nix.toml'
52-
56+ env :
57+ PR_BRANCH : ${{ github.event.pull_request.head.ref }}
58+ run : |
59+ git add gomod2nix.toml
60+ git commit -m "chore: update gomod2nix.toml" -s
61+ git push origin HEAD:"$PR_BRANCH"
62+
5363 - name : Comment on PR
5464 if : steps.changes.outputs.changed == 'true'
65+ env :
66+ PR_NUMBER : ${{ github.event.pull_request.number }}
5567 uses : actions/github-script@v8
5668 with :
5769 github-token : ${{ secrets.GITHUB_TOKEN }}
5870 script : |
5971 github.rest.issues.createComment({
60- issue_number: context.issue.number ,
72+ issue_number: Number("$PR_NUMBER") ,
6173 owner: context.repo.owner,
6274 repo: context.repo.repo,
6375 body: '✅ Updated `gomod2nix.toml` automatically via `nix develop -c gomod2nix`'
0 commit comments