Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,20 @@ jobs:
echo "No release pull request was opened or updated"
exit 0
fi
for attempt in $(seq 1 12); do
# Only the run for the branch's current head: older runs on the same branch are stale.
sha=$(gh api "repos/$GITHUB_REPOSITORY/git/ref/heads/$branch" -q .object.sha)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High workflows/release.yml:55

The approval step never selects the waiting CI run for a normal mergeable release PR, so the release PR remains blocked until manual approval. sha is the branch head commit from refs/heads/$branch, but headSha for a pull_request run is the generated merge commit; compare against the PR's merge_commit_sha instead.

-          sha=$(gh api "repos/$GITHUB_REPOSITORY/git/ref/heads/$branch" -q .object.sha)
+          sha=$(gh api "repos/$GITHUB_REPOSITORY/pulls?head=$GITHUB_REPOSITORY:$branch&state=open&per_page=1" -q '.[0].merge_commit_sha // empty')
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @.github/workflows/release.yml around line 55:

The approval step never selects the waiting CI run for a normal mergeable release PR, so the release PR remains blocked until manual approval. `sha` is the branch head commit from `refs/heads/$branch`, but `headSha` for a `pull_request` run is the generated merge commit; compare against the PR's `merge_commit_sha` instead.

for attempt in $(seq 1 24); do
run=$(gh run list -R "$GITHUB_REPOSITORY" --workflow ci.yml --branch "$branch" --event pull_request \
--status action_required --limit 1 --json databaseId -q '.[0].databaseId // empty')
--status action_required --limit 20 --json databaseId,headSha \
-q "[.[] | select(.headSha == \"$sha\")][0].databaseId // empty")
if [ -n "$run" ]; then
gh api -X POST "repos/$GITHUB_REPOSITORY/actions/runs/$run/approve"
echo "Approved CI run $run on $branch"
echo "Approved CI run $run for $branch at $sha"
exit 0
fi
sleep 5
done
echo "::warning::No CI run on $branch waits for approval; approve it in the Actions tab"
echo "::warning::No CI run for $branch at $sha waits for approval; approve it in the Actions tab"

plan:
needs: release-please
Expand Down
Loading