Skip to content

U/xiaoyun/autolabel closed pr#122

Merged
LittleLittleCloud merged 3 commits intomainfrom
u/xiaoyun/autolabelClosedPR
Nov 16, 2025
Merged

U/xiaoyun/autolabel closed pr#122
LittleLittleCloud merged 3 commits intomainfrom
u/xiaoyun/autolabelClosedPR

Conversation

@LittleLittleCloud
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings November 16, 2025 18:49
Signed-off-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
@LittleLittleCloud LittleLittleCloud merged commit 9b43acc into main Nov 16, 2025
4 checks passed
@LittleLittleCloud LittleLittleCloud deleted the u/xiaoyun/autolabelClosedPR branch November 16, 2025 18:50
@github-actions github-actions bot added this to the v0.2.0 milestone Nov 16, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a GitHub Actions workflow that automatically assigns merged PRs and their linked closed issues to version-based milestones. When a PR is merged to main, the workflow reads the current version from nuget-package.props, creates or finds the corresponding milestone, and assigns both the PR and any issues it closes to that milestone.

Key changes:

  • Adds milestone auto-assignment workflow triggered on PR merge to main
  • Extracts version from nuget-package.props to determine milestone name
  • Parses PR content to identify and assign linked closed issues to the same milestone

gh pr edit "$PR_NUMBER" --add-label "$VERSION_LABEL"
if [ -n "$MILESTONE_NUMBER" ]; then
echo "Assigning PR #$PR_NUMBER to milestone '$VERSION_MILESTONE' (number: $MILESTONE_NUMBER)"
if gh api repos/:owner/:repo/issues/$PR_NUMBER --method PATCH --field milestone="$MILESTONE_NUMBER" >/dev/null 2>&1; then
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

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

The milestone assignment API call passes the milestone number as a string instead of an integer. The GitHub API expects milestone to be an integer (the milestone number) or null. Passing it as a string field may cause the API call to fail silently or behave unexpectedly.

Change line 71 to use --field-number instead of --field:

if gh api repos/:owner/:repo/issues/$PR_NUMBER --method PATCH --field-number milestone="$MILESTONE_NUMBER" >/dev/null 2>&1; then
Suggested change
if gh api repos/:owner/:repo/issues/$PR_NUMBER --method PATCH --field milestone="$MILESTONE_NUMBER" >/dev/null 2>&1; then
if gh api repos/:owner/:repo/issues/$PR_NUMBER --method PATCH --field-number milestone="$MILESTONE_NUMBER" >/dev/null 2>&1; then

Copilot uses AI. Check for mistakes.
# Get milestone number and assign issue to milestone
MILESTONE_NUMBER=$(gh api repos/:owner/:repo/milestones --jq ".[] | select(.title == \"$VERSION_MILESTONE\") | .number" 2>/dev/null || echo "")
if [ -n "$MILESTONE_NUMBER" ]; then
if gh api repos/:owner/:repo/issues/$ISSUE_NUMBER --method PATCH --field milestone="$MILESTONE_NUMBER" >/dev/null 2>&1; then
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

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

The milestone assignment API call for issues passes the milestone number as a string instead of an integer. The GitHub API expects milestone to be an integer (the milestone number) or null. Passing it as a string field may cause the API call to fail silently or behave unexpectedly.

Change line 121 to use --field-number instead of --field:

if gh api repos/:owner/:repo/issues/$ISSUE_NUMBER --method PATCH --field-number milestone="$MILESTONE_NUMBER" >/dev/null 2>&1; then
Suggested change
if gh api repos/:owner/:repo/issues/$ISSUE_NUMBER --method PATCH --field milestone="$MILESTONE_NUMBER" >/dev/null 2>&1; then
if gh api repos/:owner/:repo/issues/$ISSUE_NUMBER --method PATCH --field-number milestone="$MILESTONE_NUMBER" >/dev/null 2>&1; then

Copilot uses AI. Check for mistakes.
Comment on lines +142 to +145
echo "✅ Auto-versioning completed!"
echo "- Added PR #$PR_NUMBER to milestone '$VERSION_MILESTONE'"
echo "- Added any linked closed issues to milestone '$VERSION_MILESTONE'"
echo "- Milestone '$VERSION_MILESTONE' now tracks all PRs and issues for this version"
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

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

The summary step indicates that labels have been added, but the workflow actually assigns PRs and issues to milestones, not labels. The message should be updated to accurately reflect the milestone assignment behavior:

echo "✅ Auto-milestone assignment completed!"
echo "- Added PR #$PR_NUMBER to milestone '$VERSION_MILESTONE'"
echo "- Added any linked closed issues to milestone '$VERSION_MILESTONE'"
echo "- Milestone '$VERSION_MILESTONE' now tracks all PRs and issues for this version"

Copilot uses AI. Check for mistakes.
@@ -73,14 +107,25 @@ jobs:

# Label each found issue
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

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

The job step name references "labeling" issues, but the workflow assigns issues to milestones. This is inconsistent with the actual functionality.

Change line 108 to:

# Assign each found issue to milestone
Suggested change
# Label each found issue
# Assign each found issue to milestone

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants