[WIP] Fix PR label handling in sync-release.yml#61
Merged
Conversation
Updated label handling in PR creation logic to use label_flags instead of labels.
Copilot stopped work on behalf of
agocke due to an error
March 13, 2026 23:45
agocke
pushed a commit
that referenced
this pull request
Mar 16, 2026
agocke
pushed a commit
that referenced
this pull request
Mar 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.
Original prompt
Problem
The "Create PR" step in
.github/workflows/sync-release.ymlfails with:even though the
bazel-synclabel exists in the repository. The root cause is thatgh pr create --labeldoes not support comma-separated labels. When the workflow passes--label "bazel-sync,bazel-sync-clean", the CLI interprets the entire string"bazel-sync,bazel-sync-clean"as a single label name, which doesn't exist.Fix
In the file
.github/workflows/sync-release.yml, in the "Create PR" step (around lines 156-191):caseblock to set alabel_flagsvariable with separate--labelflags instead of a comma-separatedlabelsstring.gh pr createcall to use$label_flags(unquoted, so word-splitting produces separate arguments) instead of--label "$labels".Before (lines 156-186):
After:
Key points:
$label_flagsmust NOT be quoted in thegh pr createcall so that bash word-splits it into separate arguments.caseblock variable assignment and thegh pr createline need to change. Everything else in the file stays the same.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: This gh action is failing even though i have a bazel-sync label in the repo: classification="clean"
report_file="/tmp/sync-report.md"
commit_subject="[release/10.0] Source code updates from dotnet/dotnet (dotnet#124136)"
commit_short="066be76ee5d"
remaining="18"
case "$classification" in⚠️ Sync ${commit_short}: ${commit_subject}"
clean)
title="✅ Sync ${commit_short}: ${commit_subject}"
labels="bazel-sync,bazel-sync-clean"
;;
build-changes)
title="
labels="bazel-sync,bazel-sync-needs-attention"
;;
conflict)
title="❌ Sync ${commit_short}: ${commit_subject}"
labels="bazel-sync,bazel-sync-conflict"
;;
*)
title="Sync ${commit_short}: ${commit_subject}"
labels="bazel-sync"
;;
esac
Prepend commit info to the report
commit_header="Upstream commit: `${commit_short}` — ${commit_subject}"
commit_header+="\nRemaining after this: $((remaining - 1)) commit(s)\n\n---\n\n"
full_body=$(printf '%s' "$commit_header" && cat "$report_file")
echo "$full_body" > "$report_file"
pr_url=$(gh pr create
--base bazel
--head "sync/release-10.0-066be76ee5d"
--title "$title"
--body-file "$report_file"
--label "$labels" 2>&1 || true)
Extract PR number from URL
pr_number=$(echo "$pr_url" | grep -oP '/pull/\K[0-9]+' || echo "")
echo "pr_number=$pr_number" >> "$GITHUB_OUTPUT"
echo "Created PR: $pr_url"
shell: /usr/bin/bash -e {0}
env:
GH_TOKEN: ***
Created PR: could not add label: 'bazel-sync' not found
Assistant: The issue is clear: the
gh pr create --label "$labels"command is failing because the labels (bazel-sync, `bazel-sync-...This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.