commit dc717575302eee483f27770f8d5c110b958c32d7 parent e360ab67cd3503b944abdfeb70ca640ba66a2948 Author: Silas Brack <silasbrack@gmail.com> Date: Mon, 1 Jun 2026 17:11:05 +0200 feat: add CI workflow to bump infrastructure flake input Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Diffstat:
| A | .forgejo/workflows/bump-infra.yml | | | 71 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 71 insertions(+), 0 deletions(-)
diff --git a/.forgejo/workflows/bump-infra.yml b/.forgejo/workflows/bump-infra.yml @@ -0,0 +1,71 @@ +name: Bump infrastructure flake input + +on: + push: + branches: [main] + +jobs: + bump: + runs-on: native + steps: + - name: Bump daily-tracker in infrastructure and create PR + env: + FORGEJO_TOKEN: ${{ secrets.INFRA_PR_TOKEN }} + run: | + set -euo pipefail + + INFRA_REPO="ssh://forgejo@git.fnarglebeast.com/silas/infrastructure.git" + BRANCH="bump-daily-tracker" + API_URL="https://git.fnarglebeast.com/api/v1" + REPO="silas/infrastructure" + + # Clone infrastructure repo + WORKDIR=$(mktemp -d) + git clone --depth 1 "$INFRA_REPO" "$WORKDIR" + cd "$WORKDIR" + + # Update the daily-tracker flake input + nix flake update daily-tracker + + # Check if anything changed + if git diff --quiet flake.lock; then + echo "No changes to flake.lock, skipping" + exit 0 + fi + + # Commit and push + git checkout -b "$BRANCH" + git add flake.lock + git \ + -c user.name="Forgejo Actions" \ + -c user.email="actions@git.fnarglebeast.com" \ + commit -m "chore: bump daily-tracker" + git push -f origin "$BRANCH" + + # Close existing PR if any + EXISTING=$(curl -sf \ + -H "Authorization: token $FORGEJO_TOKEN" \ + "$API_URL/repos/$REPO/pulls?state=open&head=silas:$BRANCH" \ + | jq '.[0].number // empty') + if [ -n "$EXISTING" ]; then + curl -sf -X PATCH \ + -H "Authorization: token $FORGEJO_TOKEN" \ + -H "Content-Type: application/json" \ + -d '{"state": "closed"}' \ + "$API_URL/repos/$REPO/pulls/$EXISTING" + fi + + # Create PR via API + curl -sf -X POST \ + -H "Authorization: token $FORGEJO_TOKEN" \ + -H "Content-Type: application/json" \ + -d "{ + \"title\": \"chore: bump daily-tracker\", + \"head\": \"$BRANCH\", + \"base\": \"main\", + \"body\": \"Automated bump of daily-tracker flake input.\" + }" \ + "$API_URL/repos/$REPO/pulls" + + # Cleanup + rm -rf "$WORKDIR"