Skip to content

Commit 37a667e

Browse files
committed
Add milestone action
1 parent 42cf786 commit 37a667e

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Add Milestone on a Merged PR
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
branches:
8+
- master
9+
- "[0-9]+.[0-9]+.x"
10+
11+
permissions: {}
12+
13+
jobs:
14+
add-milestone-pr:
15+
name: Add Milestone on PR
16+
if: github.event.pull_request.merged == true
17+
runs-on: ubuntu-latest
18+
permissions:
19+
pull-requests: write
20+
env:
21+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
GH_REPO: ${{ github.repository }}
23+
steps:
24+
- name: Checkout integrations-core repository
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
with:
27+
persist-credentials: false
28+
29+
- name: Get repo current milestone
30+
id: current-milestone
31+
run: |
32+
# Use the current_milestone field in the release.json file.
33+
MILESTONE=$(cat release.json | jq -r .current_milestone)
34+
if [ -z "$MILESTONE" ]; then
35+
echo "Error: Couldn't find the current_milestone field in the release.json file."
36+
exit 1
37+
fi
38+
39+
if [[ ! $MILESTONE =~ ^7\.[0-9]+\.[0-9]+$ ]]; then
40+
echo "Error: Malformed milestone $MILESTONE. It should be of the form '7.x.y'."
41+
exit 1
42+
fi
43+
echo "MILESTONE=$MILESTONE" >> "$GITHUB_OUTPUT"
44+
45+
- name: Set the merged PR milestone to current_milestone from release.json
46+
run: |
47+
echo "Setting milestone $MILESTONE to PR $NUMBER."
48+
gh issue edit "$NUMBER" --milestone "$MILESTONE"
49+
env:
50+
NUMBER: ${{ github.event.number }}
51+
MILESTONE: ${{ steps.current-milestone.outputs.MILESTONE }}

release.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"current_milestone": "7.69.0"
3+
}

0 commit comments

Comments
 (0)