File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 44name : Approve flake.lock PRs (still require 1 human approval)
55permissions :
66 pull-requests : write
7+ on :
8+ pull_request_target :
9+ paths :
10+ - ' flake.lock' # only run if flake.lock has changed
711jobs :
812 approve-flake-lock-prs :
913 runs-on : ubuntu-latest
1014 if : github.actor == 'github-actions[bot]' && github.event.pull_request.labels.*.name == 'flake.lock automation'
1115 steps :
1216 - name : Approve flake.lock PRs (still requires 1 human approval)
13- run : gh pr review --approve "$PR_URL"
17+ run : |
18+ # only run if only exactly 1 file is changed;
19+ # this combined with the `paths:` filter on the job itself
20+ # ensures that the PR changes ONLY flake.lock and no other files
21+ if [[ "$(git diff --name-only HEAD..origin/main | wc -l)" = 1 ]]; then
22+ gh pr review --approve "$PR_URL"
23+ end
1424 env :
1525 PR_URL : ${{github.event.pull_request.html_url}}
1626 GH_TOKEN : ${{secrets.GITHUB_TOKEN}}
You can’t perform that action at this time.
0 commit comments