Skip to content

Commit dbd7b9a

Browse files
committed
feat: enable automerge for flake.lock update PRs
Automatically enable rebase automerge on PRs created by the update-flake-lock workflow using GH_TOKEN_FOR_UPDATES secret.
1 parent 2004ad1 commit dbd7b9a

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.github/workflows/update-flake-lock.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@ jobs:
66
steps:
77
- uses: actions/checkout@v4
88
- uses: DeterminateSystems/determinate-nix-action@v3
9-
- name: Update flake.lock
9+
- id: update
10+
name: Update flake.lock
1011
uses: DeterminateSystems/update-flake-lock@main
1112
with:
1213
pr-labels: |-
1314
dependencies
1415
automated
1516
pr-title: 'chore: update flake.lock'
17+
- env:
18+
GH_TOKEN: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
19+
if: steps.update.outputs.pull-request-number != ''
20+
name: Enable automerge
21+
run: gh pr merge --auto --rebase ${{ steps.update.outputs.pull-request-number }}
1622
name: Update flake.lock
1723
"on":
1824
schedule:

dev/flake-module.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,22 @@
166166
uses = "DeterminateSystems/determinate-nix-action@v3";
167167
}
168168
{
169+
id = "update";
169170
name = "Update flake.lock";
170171
uses = "DeterminateSystems/update-flake-lock@main";
171172
with_ = {
172173
pr-title = "chore: update flake.lock";
173174
pr-labels = "dependencies\nautomated";
174175
};
175176
}
177+
{
178+
name = "Enable automerge";
179+
if_ = "steps.update.outputs.pull-request-number != ''";
180+
run = "gh pr merge --auto --rebase \${{ steps.update.outputs.pull-request-number }}";
181+
env = {
182+
GH_TOKEN = "\${{ secrets.GH_TOKEN_FOR_UPDATES }}";
183+
};
184+
}
176185
];
177186
};
178187
};

0 commit comments

Comments
 (0)