diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index a5352be..dad76ed 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -24,9 +24,10 @@ jobs: env: PREEM_PUSH_TOKEN: ${{ secrets.PREEM_PUSH_TOKEN }} - # nightly-flake-update.yaml opens PRs from flake-update-* branches; if - # the build fails on one of those, close it rather than leaving a - # broken auto-generated PR around. Scoped to that branch prefix so a + # flake-update.yaml opens PRs from flake-update-* branches; if the + # build fails on one of those, close it and delete the branch rather + # than leaving a broken auto-generated PR around (and so a same-day + # rerun can push the branch again). Scoped to that branch prefix so a # failing build on a human-authored PR is never auto-closed. close-on-failure: needs: build @@ -39,5 +40,9 @@ jobs: -H "Content-Type: application/json" \ -d '{"state": "closed"}' \ "https://forge.darkest.space/api/v1/repos/mara/nixos-configs/pulls/${{ github.event.pull_request.number }}" + curl -sf -X DELETE \ + -H "Authorization: token ${PR_BOT_TOKEN}" \ + "https://forge.darkest.space/api/v1/repos/mara/nixos-configs/branches/${HEAD_REF}" env: PR_BOT_TOKEN: ${{ secrets.PR_BOT_TOKEN }} + HEAD_REF: ${{ github.head_ref }}