Skip to content

Commit 188b0bb

Browse files
Add next-release milestone via GitHub Actions workflow to automated PRs (#3337)
* Initial plan * Add next-release milestone assignment to automated PRs via Mergify Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> * Fix invalid Mergify config: replace non-existent milestone action with GitHub Actions workflow Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> * Add copilot[bot] to automated PR milestone assignment Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> * Fix Copilot bot login: use Copilot instead of copilot[bot] Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
1 parent edf8889 commit 188b0bb

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/milestone.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Assign milestone to automated PRs
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, reopened]
6+
7+
jobs:
8+
assign-milestone:
9+
name: Assign next-release milestone
10+
runs-on: ubuntu-latest
11+
if: contains(fromJSON('["dependabot[bot]", "transifex-integration[bot]", "imgbot[bot]", "Copilot"]'), github.event.pull_request.user.login)
12+
permissions:
13+
issues: write
14+
pull-requests: write
15+
steps:
16+
- name: Assign milestone
17+
uses: actions/github-script@v7
18+
with:
19+
script: |
20+
const milestones = await github.rest.issues.listMilestones({
21+
owner: context.repo.owner,
22+
repo: context.repo.repo,
23+
state: 'open'
24+
});
25+
26+
const milestone = milestones.data.find(m => m.title === 'next-release');
27+
28+
if (!milestone) {
29+
core.warning('Milestone "next-release" not found');
30+
return;
31+
}
32+
33+
await github.rest.issues.update({
34+
owner: context.repo.owner,
35+
repo: context.repo.repo,
36+
issue_number: context.payload.pull_request.number,
37+
milestone: milestone.number
38+
});

0 commit comments

Comments
 (0)