Skip to content

update-flake-lock

update-flake-lock #33

# 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/create-pull-request@v6.0.5
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 }}