66 lines
2 KiB
YAML
66 lines
2 KiB
YAML
name: "Update flake.lock"
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: '0 0 * * 0' # Weekly on Sunday at midnight UTC
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
update-flake-lock:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Mint flake update token
|
|
id: flake-token
|
|
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3
|
|
with:
|
|
app-id: ${{ secrets.FLAKE_UPDATE_APP_ID }}
|
|
private-key: ${{ secrets.FLAKE_UPDATE_APP_PRIVATE_KEY }}
|
|
owner: gastownhall
|
|
repositories: beads
|
|
permission-contents: write
|
|
permission-pull-requests: write
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
ref: main
|
|
token: ${{ steps.flake-token.outputs.token }}
|
|
|
|
- name: Install Nix
|
|
uses: DeterminateSystems/determinate-nix-action@f4c468f2287f0f14a113841b41f2dc8957119519 # v3
|
|
|
|
- name: Update flake.lock
|
|
run: nix flake update
|
|
|
|
- name: Verify update scope
|
|
run: |
|
|
changed_files="$(git diff --name-only)"
|
|
untracked_files="$(git ls-files --others --exclude-standard)"
|
|
|
|
if [ -n "$untracked_files" ]; then
|
|
echo "Unexpected untracked files:"
|
|
echo "$untracked_files"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -n "$changed_files" ] && [ "$changed_files" != "flake.lock" ]; then
|
|
echo "Unexpected changed files:"
|
|
echo "$changed_files"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Create pull request
|
|
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
|
|
with:
|
|
token: ${{ steps.flake-token.outputs.token }}
|
|
commit-message: "flake.lock: Update"
|
|
base: main
|
|
branch: update_flake_lock_action
|
|
delete-branch: true
|
|
add-paths: flake.lock
|
|
title: "chore(nix): update flake.lock"
|
|
body: |
|
|
Automated flake.lock update generated by the scheduled Nix workflow.
|