nixos-configuration/.forgejo/workflows/flake-update.yaml
müde 50bfc1ac6b
Some checks failed
build / build (muede-lpt2) (push) Has been cancelled
build / build (muede-pc2) (push) Has been cancelled
build / close-on-failure (push) Has been cancelled
workflows to update specific inputs
2026-09-14 22:15:07 +02:00

51 lines
1.5 KiB
YAML

name: flake update
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
inputs:
target:
description: 'Inputs to update'
type: choice
default: all
options:
- all
- hyperhive
- trollshell
jobs:
update:
runs-on: nixos
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
- run: |
target="${{ github.event.inputs.target }}"
target="${target:-all}"
case "$target" in
all) inputs="" ;;
hyperhive) inputs="hyperhive hyperhive-website" ;;
trollshell) inputs="trollshell" ;;
esac
nix flake update $inputs
if git diff --quiet -- flake.lock; then
exit 0
fi
branch="flake-update-${target}-$(date +%F)"
git checkout -b "$branch"
git -c user.name="flake-bot" -c user.email="git+flake-bot@darkest.space" \
commit -am "nix flake update ($target)"
git push "https://flake-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" --arg t "$target" \
'{title: ("nix flake update (" + $t + ")"), head: $h, base: "main"}')" \
"https://forge.darkest.space/api/v1/repos/mara/nixos-configs/pulls"
env:
PR_BOT_TOKEN: ${{ secrets.PR_BOT_TOKEN }}