Skip to content

Commit 4bdaa21

Browse files
committed
ci: use khanelibot for update flake lock
1 parent 2234960 commit 4bdaa21

1 file changed

Lines changed: 51 additions & 2 deletions

File tree

.github/workflows/update-flakes.yml

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,66 @@ on:
55
schedule:
66
- cron: "0 0 * * *"
77
jobs:
8-
createPullRequest:
8+
update-flake-lock:
99
runs-on: ubuntu-latest
1010
steps:
11+
- name: Create GitHub App token
12+
uses: actions/create-github-app-token@v2
13+
if: vars.CI_APP_ID
14+
id: app-token
15+
with:
16+
app-id: ${{ vars.CI_APP_ID }}
17+
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}
18+
permission-contents: write
19+
permission-pull-requests: write
20+
permission-issues: write
21+
- name: Get GitHub App user info
22+
id: user-info
23+
if: vars.CI_APP_ID
24+
env:
25+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
26+
slug: ${{ steps.app-token.outputs.app-slug }}
27+
run: |
28+
name="$slug[bot]"
29+
id=$(gh api "/users/$name" --jq .id)
30+
{
31+
echo "id=$id"
32+
echo "name=$name"
33+
echo "email=$id+$name@users.noreply.github.com"
34+
} >> "$GITHUB_OUTPUT"
1135
- uses: actions/checkout@v4
36+
- name: Setup Git
37+
env:
38+
name: ${{ steps.user-info.outputs.name || 'github-actions[bot]' }}
39+
email: ${{ steps.user-info.outputs.email || '41898282+github-actions[bot]@users.noreply.github.com' }}
40+
run: |
41+
git config user.name "$name"
42+
git config user.email "$email"
1243
- name: Install Nix
1344
uses: cachix/install-nix-action@v31
45+
env:
46+
GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
1447
with:
1548
extra_nix_config: |
16-
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
49+
access-tokens = github.com=${{github.token}}
1750
- name: Update flake.lock
1851
uses: DeterminateSystems/update-flake-lock@v26
1952
with:
53+
token: ${{ steps.app-token.outputs.token || github.token }}
54+
git-committer-name: ${{ steps.user-info.outputs.name || 'github-actions[bot]' }}
55+
git-committer-email: ${{ steps.user-info.outputs.email || '41898282+github-actions[bot]@users.noreply.github.com' }}
56+
git-author-name: ${{ steps.user-info.outputs.name || 'github-actions[bot]' }}
57+
git-author-email: ${{ steps.user-info.outputs.email || '41898282+github-actions[bot]@users.noreply.github.com' }}
58+
pr-body: |
59+
Automated update by the [update-flake-lock] GitHub Action.
60+
61+
```
62+
{{ env.GIT_COMMIT_MESSAGE }}
63+
```
64+
65+
This PR was most recently updated by workflow run [${{ github.run_id }}].
66+
67+
[update-flake-lock]: https://github.com/DeterminateSystems/update-flake-lock
68+
[${{ github.run_id }}]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
2069
pr-labels: |
2170
merge-queue

0 commit comments

Comments
 (0)