--- name: "Update flake.lock" on: schedule: - cron: "0 0 1 * *" workflow_dispatch: jobs: pre-job: continue-on-error: true runs-on: ubuntu-latest permissions: {} outputs: number: ${{ steps.skip_check.outputs.number }} steps: - uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 with: persist-credentials: false - id: skip_check run: | echo "number=$(gh pr list --label flake-lock-update --state open --json id | jq 'length')" >> "$GITHUB_OUTPUT" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} update: runs-on: ubuntu-latest permissions: {} needs: pre-job if: needs.pre-job.outputs.number == '0' steps: - uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 with: ssh-key: ${{ secrets.FOLLOW_NIXPKGS_PRIVATE_KEY }} ref: main persist-credentials: false - uses: ./.github/actions/setup-nix - run: | git config user.name 'github-actions[bot]' git config user.email 'github-actions[bot]@users.noreply.github.com' - run: nix flake update --commit-lock-file - name: Get Date id: date run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT" - name: Create Pull Request id: cpr uses: peter-evans/create-pull-request@d32e88dac789dcc7906e7d26f69f24116fa9c97d with: title: Update flake.lock ${{ steps.date.outputs.date }} labels: flake-lock-update branch: ci/flake-update - name: Enable automerge if: steps.cpr.outputs.pull-request-number run: gh pr merge --squash --auto "${STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER}" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER: ${{ steps.cpr.outputs.pull-request-number }}