Skip to content

Commit 600e352

Browse files
authored
build: add auto-milestone workflow on pr merge (#2114)
Signed-off-by: Adam Setch <[email protected]>
1 parent 9779475 commit 600e352

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/milestone.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Add milestone on PR merge
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types:
8+
- closed
9+
10+
permissions:
11+
pull-requests: write
12+
13+
jobs:
14+
add-milestone:
15+
if: github.event.pull_request.merged == true
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Authenticate GitHub CLI
19+
run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
20+
21+
- name: Get open milestone
22+
id: milestone
23+
run: |
24+
milestone=$(gh api repos/${{ github.repository }}/milestones \
25+
--jq '.[] | select(.state=="open") | .title' | head -n 1)
26+
echo "Found milestone: $milestone"
27+
echo "milestone=$milestone" >> $GITHUB_ENV
28+
29+
- name: Add milestone to PR
30+
if: env.milestone != ''
31+
run: |
32+
gh pr edit ${{ github.event.pull_request.number }} \
33+
--repo ${{ github.repository }} \
34+
--milestone "${{ env.milestone }}"

0 commit comments

Comments
 (0)