From a8b8d102a447587b0f7e8df4c13fde10c771a639 Mon Sep 17 00:00:00 2001 From: YiWang24 Date: Mon, 25 May 2026 22:46:50 -0400 Subject: [PATCH] fix(ci): fix guard condition and add auto-merge to bump-sha MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two fixes: 1. Guard condition: The 'Manage PRs' step only checked steps.push-branch.outputs.skip, but when the guard skips all steps, push-branch never runs and its outputs are empty — causing the step to execute with empty env vars and fail. Add steps.guard.outputs.skip check to prevent this. 2. Auto-merge: After creating the bump PR, enable auto-merge with gh pr merge --auto --squash so the PR self-merges once required checks pass. The bump commit only touches manifest.yml and was already tested by the triggering workflow. --- .github/workflows/on-main-bump-sha.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/on-main-bump-sha.yml b/.github/workflows/on-main-bump-sha.yml index 549e4c8..ced2907 100644 --- a/.github/workflows/on-main-bump-sha.yml +++ b/.github/workflows/on-main-bump-sha.yml @@ -156,7 +156,7 @@ jobs: echo "::notice::Pushed branch ${branch}" - name: Manage PRs — close old, clean orphans, open new - if: steps.push-branch.outputs.skip != 'true' + if: steps.guard.outputs.skip != 'true' && steps.push-branch.outputs.skip != 'true' env: GH_TOKEN: ${{ github.token }} NEW_SHA: ${{ steps.check.outputs.new_sha }} @@ -204,10 +204,23 @@ jobs: --json number --jq '.[0].number // ""')" if [ -n "${existing}" ]; then echo "::notice::PR #${existing} already exists for ${branch}; skipping create" + pr_number="${existing}" else - gh pr create \ + pr_url="$(gh pr create \ --title "chore(manifest): bump YiAgent/OpenCI SHA to ${short_new}" \ --body-file /tmp/pr-body.md \ --base main \ - --head "${branch}" + --head "${branch}")" + pr_number="${pr_url##*/}" + echo "::notice::Created PR #${pr_number}" + fi + + # 4) Enable auto-merge on the PR so it merges once required checks pass. + # The bump commit only changes manifest.yml and was already tested + # as part of the triggering merge — auto-merging avoids manual + # intervention while still respecting branch protection rules. + if [ -n "${pr_number}" ]; then + gh pr merge "${pr_number}" --auto --squash \ + --subject "chore(manifest): bump YiAgent/OpenCI SHA to ${short_new} (#${pr_number})" \ + || echo "::warning::Auto-merge not enabled — repo may lack 'Allow auto-merge' setting." fi