33 lines
1 KiB
YAML
33 lines
1 KiB
YAML
name: nightly flake update
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 3 * * *'
|
|
workflow_dispatch: {}
|
|
|
|
jobs:
|
|
update:
|
|
runs-on: nixos
|
|
steps:
|
|
- uses: https://code.forgejo.org/actions/checkout@v4
|
|
- run: |
|
|
nix flake update
|
|
|
|
if git diff --quiet -- flake.lock; then
|
|
exit 0
|
|
fi
|
|
|
|
branch="flake-update-$(date +%F)"
|
|
git checkout -b "$branch"
|
|
git -c user.name="flake-update-bot" -c user.email="flake-update-bot@darkest.space" \
|
|
commit -am "flake: nightly update"
|
|
git push "https://flake-update-bot:${PR_BOT_TOKEN}@forge.darkest.space/mara/nixos-configs.git" "$branch"
|
|
|
|
curl -sf -X POST \
|
|
-H "Authorization: token ${PR_BOT_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "$(jq -n --arg h "$branch" \
|
|
'{title: "flake: nightly update", head: $h, base: "main"}')" \
|
|
"https://forge.darkest.space/api/v1/repos/mara/nixos-configs/pulls"
|
|
env:
|
|
PR_BOT_TOKEN: ${{ secrets.PR_BOT_TOKEN }}
|