Repository navigation
Run milestone management automatically on release tag push #36140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
5fe0eea
74da2ff
da0aee6
22dfd89
5ccd265
3076cb1
960e54b
b153b01
2a08256
161eb78
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,25 @@ on: | |
| types: [closed] | ||
| branches: [main, net*.0, inflight/*, release/*] | ||
|
|
||
| # When a stable release tag is pushed (e.g. 10.0.80), audit the entire tag | ||
| # cohort and fix any milestone drift, closing issues fixed by PRs that | ||
| # shipped in this tag. The pattern matches MAJOR.MINOR.PATCH where MAJOR is | ||
| # pinned to a currently-supported major (10 or 11) to bound the blast radius — | ||
| # a stray tag like 1.2.3 or 7.0.0 must NOT fire the bulk -Apply path. Because | ||
| # GitHub Actions filter patterns must match the whole ref, preview/rc tags | ||
| # like 11.0.0-preview.5.26304.4 or 10.0.0-rc.1.25424.2 are deliberately | ||
| # excluded (the trailing -preview/-rc suffix breaks the full-ref match). | ||
| # NOTE: bump this glob (and the bash guard below) when a new major ships. | ||
| # | ||
| # NOTE: a tag pushed using the default GITHUB_TOKEN does NOT trigger this | ||
| # workflow — GitHub suppresses workflow runs for events raised by the default | ||
| # token to avoid loops. Release tags must therefore be pushed by a human or by | ||
| # automation using a PAT / GitHub App token, otherwise this trigger will | ||
| # silently never fire (today SR tags are pushed by a maintainer, so it does). | ||
| push: | ||
| tags: | ||
| - '1[01].[0-9]+.[0-9]+' | ||
|
|
||
|
|
||
| workflow_dispatch: | ||
| inputs: | ||
| pr_number: | ||
|
|
@@ -38,8 +57,9 @@ permissions: | |
|
|
||
| jobs: | ||
| manage-milestones: | ||
| # For PR merges: only run when actually merged (not just closed) | ||
| if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true | ||
| # For PR merges: only run when actually merged (not just closed). | ||
| # Tag pushes and manual dispatches always run. | ||
| if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' || github.event.pull_request.merged == true | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout with full history | ||
|
|
@@ -57,11 +77,23 @@ jobs: | |
| INPUT_CREATE_ISSUE: ${{ inputs.create_issue }} | ||
| INPUT_CLOSE_FIXED_ISSUES: ${{ inputs.close_fixed_issues }} | ||
| PR_BASE_REF: ${{ github.event.pull_request.base.ref }} | ||
| PUSH_TAG: ${{ github.ref_name }} | ||
| EVENT_NAME: ${{ github.event_name }} | ||
| run: | | ||
| ARGS=() | ||
|
|
||
| if [ "$EVENT_NAME" = "pull_request_target" ]; then | ||
| if [ "$EVENT_NAME" = "push" ]; then | ||
| # Release tag pushed: audit the whole tag cohort, fix milestone | ||
| # drift, and close issues fixed by PRs that shipped in this tag. | ||
| # Defense-in-depth: the `on.push.tags` filter already restricts to | ||
| # MAJOR.MINOR.PATCH, but re-validate here so an unexpected ref can | ||
| # never be passed through to the script's tag-mode. | ||
| if [[ ! "$PUSH_TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
| echo "::error::push tag '$PUSH_TAG' is not a stable release tag (expected MAJOR.MINOR.PATCH)" | ||
| exit 1 | ||
| fi | ||
|
|
||
| ARGS+=('-Tag' "$PUSH_TAG" '-Apply' '-CloseFixedIssues') | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
All three reviewers independently flagged that this fires bulk, irreversible issue closures + milestone moves on any push of a
I deliberately did not add the |
||
| elif [ "$EVENT_NAME" = "pull_request_target" ]; then | ||
| # Auto-trigger: set milestone on the merged PR | ||
| ARGS+=('-PrNumber' "$INPUT_PR_NUMBER" '-Apply') | ||
| # GitHub only auto-closes "fixes #N" issues for PRs merged to the | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.