flake-update #39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: flake-update | |
| on: | |
| schedule: | |
| # Runs at 04:00 UTC daily | |
| - cron: "0 4 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write # push branches | |
| pull-requests: write # open PRs & enable auto-merge | |
| concurrency: | |
| group: flake-lock-updater | |
| cancel-in-progress: false | |
| jobs: | |
| update-flake-lock: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout (full history for clean diffs) | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Nix | |
| uses: DeterminateSystems/nix-installer-action@v13 | |
| - name: Update flake.lock | |
| run: | | |
| set -euo pipefail | |
| nix --version | |
| nix flake update | |
| # if nothing changed, bail out early | |
| if git diff --quiet -- flake.lock; then | |
| echo "No flake.lock changes." | |
| echo "no_changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "no_changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| id: update | |
| - name: Create pull request | |
| if: steps.update.outputs.no_changes == 'false' | |
| id: cpr | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| token: ${{ secrets.BOT_GITHUB_TOKEN }} | |
| commit-message: "flake.lock: Update" | |
| title: "flake.lock: Update" | |
| body: | | |
| Automated `nix flake update`. | |
| branch: flake-lock-update | |
| delete-branch: true | |
| signoff: false | |
| add-paths: | | |
| flake.lock | |
| - name: Enable auto-merge (squash) | |
| if: steps.update.outputs.no_changes == 'false' | |
| uses: peter-evans/enable-pull-request-automerge@v3 | |
| with: | |
| token: ${{ secrets.BOT_GITHUB_TOKEN }} | |
| pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} | |
| merge-method: squash |