diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 376fe25..ef09c45 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -47,7 +47,7 @@ jobs: flakehub-publish: runs-on: ubuntu-latest needs: [check, package-build] - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main' permissions: id-token: write contents: read @@ -65,7 +65,7 @@ jobs: flakehub-verify: runs-on: ubuntu-latest needs: flakehub-publish - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main' steps: - uses: DeterminateSystems/determinate-nix-action@629b284231c2a82554b724e357e47fc6020833c8 # v3 diff --git a/.github/workflows/update-opencode.yml b/.github/workflows/update-opencode.yml index e2c2af6..82ee709 100644 --- a/.github/workflows/update-opencode.yml +++ b/.github/workflows/update-opencode.yml @@ -105,6 +105,32 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: gh pr merge "${{ steps.create-pr.outputs.pull-request-number }}" --auto --squash --delete-branch + # Auto-merges performed with GITHUB_TOKEN do not emit a push event. Wait + # for the required PR checks and auto-merge, then explicitly start the + # main-branch publish/verification pipeline. + - name: Dispatch post-merge checks + if: steps.check.outputs.update_needed == 'true' && steps.create-pr.outputs.pull-request-number + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ steps.create-pr.outputs.pull-request-number }} + run: | + for _ in $(seq 1 120); do + state="$(gh pr view "$PR_NUMBER" --json state --jq .state)" + case "$state" in + MERGED) + gh workflow run check.yml --ref main + exit 0 + ;; + CLOSED) + echo "Update PR closed without merge" >&2 + exit 1 + ;; + esac + sleep 10 + done + echo "Timed out waiting for update PR auto-merge" >&2 + exit 1 + - name: Summary if: always() run: |