update-flake-lock #35
This file contains 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
# This workflow automates the process of updating all flake inputs and generates | |
# a pull request (PR) that auto-merges if all checks pass successfully. | |
name: update-flake-lock | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 9 * * 1' # Runs weekly on Monday at 9:00am | |
jobs: | |
update-flake-lock: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@main | |
- name: Update All flake.lock Files | |
run: | | |
nix flake update --accept-flake-config | |
cd "$GITHUB_WORKSPACE/templates/haskell" | |
nix flake update --accept-flake-config | |
cd "$GITHUB_WORKSPACE/templates/vanilla" | |
nix flake update --accept-flake-config | |
cd "$GITHUB_WORKSPACE" | |
git add . | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/[email protected] | |
with: | |
title: Weekly Update of All flake.lock Files | |
commit-message: Weekly Update of All flake.lock Files | |
delete-branch: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Enable Pull Request Auto-Merge | |
if: steps.cpr.outputs.pull-request-operation == 'created' | |
uses: peter-evans/enable-pull-request-automerge@v3 | |
with: | |
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} | |
merge-method: squash | |
token: ${{ secrets.GITHUB_TOKEN }} |