diff options
| -rw-r--r-- | .github/workflows/update-flake.yaml | 51 |
1 files changed, 11 insertions, 40 deletions
diff --git a/.github/workflows/update-flake.yaml b/.github/workflows/update-flake.yaml index 13a0416..b586abe 100644 --- a/.github/workflows/update-flake.yaml +++ b/.github/workflows/update-flake.yaml @@ -1,4 +1,4 @@ -name: Update lockfiles +name: Update flake.lock on: schedule: @@ -15,52 +15,23 @@ jobs: contents: write pull-requests: write - env: - PR_BRANCH: "update-lockfiles" - steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Nix - uses: cachix/install-nix-action@V27 - - - name: Set Git user info - run: | - git config user.name 'github-actions[bot]' - git config user.email 'github-actions[bot]@users.noreply.github.com' - - - name: Create new branch - id: branch - run: | - git switch -c "$PR_BRANCH" - - - name: Update flake inputs - run: | - nix flake update \ - --commit-lock-file \ - --commit-lockfile-summary "nix: update flake.lock" - - - name: Make PR if needed - env: - GH_TOKEN: ${{ secrets.MERGE_TOKEN }} - run: | - if ! git diff --color=always --exit-code origin/main; then - git fetch origin "$PR_BRANCH" || true - git push --force-with-lease -u origin "$PR_BRANCH" + uses: DeterminateSystems/nix-installer-action@v12 - open_prs="$(gh pr list --base main --head "$PR_BRANCH" | wc -l)" - if [ "$open_prs" -eq 0 ]; then - gh pr create \ - --base main \ - --head "$PR_BRANCH" \ - --title "nix: update flake.lock" \ - --fill - fi - fi + - name: Update flake.lock & make PR + uses: DeterminateSystems/update-flake-lock@v22 + id: update + with: + commit-msg: "nix: update flake.lock" + pr-title: "nix: update flake.lock" - name: Enable auto-merge - shell: bash - run: gh pr merge --auto --squash + if: env.PR_ID != '' + run: gh pr merge --auto --squash "$PR_ID" env: GH_TOKEN: ${{ secrets.MERGE_TOKEN }} + PR_ID: ${{ steps.update.outputs.pull-request-number }} |
