ALPHA: wire is a tool to deploy nixos systems
wire.althaea.zone/
1---
2name: "Update flake.lock"
3on:
4 schedule:
5 - cron: "0 0 1 * *"
6 workflow_dispatch:
7jobs:
8 pre-job:
9 continue-on-error: true
10 runs-on: ubuntu-latest
11 permissions: {}
12 outputs:
13 number: ${{ steps.skip_check.outputs.number }}
14 steps:
15 - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
16 with:
17 persist-credentials: false
18 - id: skip_check
19 run: |
20 echo "number=$(gh pr list --label flake-lock-update --state open --json id | jq 'length')" >> "$GITHUB_OUTPUT"
21 env:
22 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 update:
24 runs-on: ubuntu-latest
25 permissions: {}
26 needs: pre-job
27 if: needs.pre-job.outputs.number == '0'
28 steps:
29 - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
30 with:
31 ssh-key: ${{ secrets.FOLLOW_NIXPKGS_PRIVATE_KEY }}
32 ref: main
33 persist-credentials: false
34 - uses: ./.github/actions/setup-nix
35 - run: |
36 git config user.name 'github-actions[bot]'
37 git config user.email 'github-actions[bot]@users.noreply.github.com'
38 - run: nix flake update --commit-lock-file
39 - name: Get Date
40 id: date
41 run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
42 - name: Create Pull Request
43 id: cpr
44 uses: peter-evans/create-pull-request@0979079bc20c05bbbb590a56c21c4e2b1d1f1bbe
45 with:
46 title: Update flake.lock ${{ steps.date.outputs.date }}
47 labels: flake-lock-update
48 branch: ci/flake-update
49 - name: Enable automerge
50 if: steps.cpr.outputs.pull-request-number
51 run: gh pr merge --squash --auto "${STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER}"
52 env:
53 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54 STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER: ${{ steps.cpr.outputs.pull-request-number }}