forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 10
38 lines (31 loc) · 1.13 KB
/
assign_milestone.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Assign Milestone
on:
pull_request_target:
types: [opened]
permissions:
pull-requests: write
contents: read
env:
GH_TOKEN: ${{ github.token }}
jobs:
build:
name: Assign Milestone
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
# We must explicitly checkout the base's SHA to avoid executing any code coming from
# the PR's SHA - Which would be executed in the base branch's context.
# This is really important to limit any sort of pwn requests.
ref: ${{ github.base_ref }}
persist-credentials: 'false'
- name: Assign Milestone
run: |
# Ensure the content we sed from version.go is sanitized and match the correct format
VERSION=$(sed -n 's/.*versionName.*\"\([[:digit:]\.]*\).*\"/\1/p' ./go/vt/servenv/version.go)
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version format: $VERSION"
exit 1
fi
gh pr edit ${{ github.event.number }} --milestone "v$VERSION"