From bdf59b8bbc0b27c6422645c18500ff520cdbd2c8 Mon Sep 17 00:00:00 2001 From: Florent Poinsard <35779988+frouioui@users.noreply.github.com> Date: Mon, 3 Apr 2023 07:33:48 +0200 Subject: [PATCH] Automatically add milestone to new Pull Request (#12759) * Automatically add milestone to new Pull Request Signed-off-by: Florent Poinsard * Run the workflow on pull_request_target event Signed-off-by: Florent Poinsard * Use gh pr edit to add milestone Signed-off-by: Florent Poinsard * Use bash instead of go script Signed-off-by: Florent Poinsard --------- Signed-off-by: Florent Poinsard --- .github/workflows/assign_milestone.yml | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/assign_milestone.yml diff --git a/.github/workflows/assign_milestone.yml b/.github/workflows/assign_milestone.yml new file mode 100644 index 00000000000..dcc698a8b50 --- /dev/null +++ b/.github/workflows/assign_milestone.yml @@ -0,0 +1,30 @@ +name: Assign Milestone + +on: + pull_request_target: + types: [opened] + +permissions: read-all + +env: + GH_TOKEN: ${{ github.token }} + +jobs: + build: + name: Assign Milestone + runs-on: ubuntu-22.04 + permissions: + pull-requests: write + + steps: + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.20.2 + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Assign Milestone + run: | + gh pr edit ${{ github.event.number }} --milestone "v$(sed -n 's/.*versionName.*\"\([[:digit:]\.]*\).*\"/\1/p' ./go/vt/servenv/version.go)"