-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (66 loc) · 2.44 KB
/
flake_update.yml
File metadata and controls
73 lines (66 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: update-flakes
on:
schedule:
- cron: "0 */12 * * *"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
get-flake-inputs:
runs-on: ubuntu-latest
outputs:
flake-inputs: ${{ steps.get-flake-inputs.outputs.flake-inputs }}
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
sparse-checkout: flake.lock
- id: get-flake-inputs
run: |
if [ -f flake.lock ]; then
flake_inputs="$(jq -c '.nodes.root.inputs | {flake: keys}' flake.lock)"
else
echo "flake.lock not found. Assuming no inputs for update."
flake_inputs='{"flake":[]}'
fi
echo "flake-inputs=${flake_inputs}" >> "$GITHUB_OUTPUT"
update-flake:
name: update-${{ matrix.flake }}
runs-on: ubuntu-latest
needs: get-flake-inputs
if: ${{ fromJson(needs.get-flake-inputs.outputs.flake-inputs).flake != '[]' }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.get-flake-inputs.outputs.flake-inputs) }}
steps:
- uses: actions/checkout@v6
with:
lfs: false
persist-credentials: false
# Generate a GitHub App token for creating the PR
- name: Generate App Token
id: generate_token
uses: peter-murray/workflow-application-token-action@v4
with:
application_id: ${{ secrets.APP_ID }}
application_private_key: ${{ secrets.APP_PRIVATE_KEY }}
# Configure Git for FlakeBuilderApp
- name: Configure Git for FlakeBuilderApp
run: |
git config --global user.email "flakebuilderapp[bot]@users.noreply.github.com"
git config --global user.name "flakebuilderapp[bot]"
echo "Git user configured: $(git config --global user.name) <$(git config --global user.email)>"
- uses: DeterminateSystems/nix-installer-action@v22
with:
extra-conf: accept-flake-config = true
- name: Update Flake Dependency and Create PR
uses: cpcloud/flake-update-action@v2.0.1
with:
dependency: ${{ matrix.flake }}
pull-request-token: ${{ steps.generate_token.outputs.token }}
github-token: ${{ steps.generate_token.outputs.token }}
pull-request-author: "flakebuilderapp[bot] <flakebuilderapp[bot]@users.noreply.github.com>"
delete-branch: true
pull-request-branch-prefix: update-
automerge: true