From 9b3e6b072b99c6ea0ef849023649852e0c98b9ce Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Fri, 2 Aug 2024 17:10:05 +1000 Subject: [PATCH 1/4] Set milestone using GitHub actions --- .../workflows/assign-milestone-on-close.yml | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/assign-milestone-on-close.yml diff --git a/.github/workflows/assign-milestone-on-close.yml b/.github/workflows/assign-milestone-on-close.yml new file mode 100644 index 00000000000..c40706feb6b --- /dev/null +++ b/.github/workflows/assign-milestone-on-close.yml @@ -0,0 +1,41 @@ +name: Assign Milestone on Close + +env: + MILESTONE_ID: 1 + +on: + issues: + types: [closed] + pull_request: + types: [closed] + +jobs: + assign-milestone: + runs-on: ubuntu-latest + steps: + - name: Check if milestone is set + id: check-milestone + uses: actions/github-script@v7 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const issueOrPr = context.payload.issue || context.payload.pull_request; + if (!issueOrPr.milestone) { + core.setOutput('milestoneNotSet', 'true'); + } else { + core.setOutput('milestoneNotSet', 'false'); + } + + - name: Assign default milestone + if: steps.check-milestone.outputs.milestoneNotSet == 'true' + uses: actions/github-script@v7 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const issueOrPrNumber = (context.payload.issue || context.payload.pull_request).number; + const repository = context.repo; + await github.rest.issues.update({ + ...repository, + issue_number: issueOrPrNumber, + milestone: process.env.MILESTONE_ID + }); From 1deb999f87511ee5a9cf979d200e40bd1374a050 Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Fri, 2 Aug 2024 17:24:06 +1000 Subject: [PATCH 2/4] Update .github/workflows/assign-milestone-on-close.yml --- .github/workflows/assign-milestone-on-close.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/assign-milestone-on-close.yml b/.github/workflows/assign-milestone-on-close.yml index c40706feb6b..eb4336809e0 100644 --- a/.github/workflows/assign-milestone-on-close.yml +++ b/.github/workflows/assign-milestone-on-close.yml @@ -1,7 +1,7 @@ name: Assign Milestone on Close env: - MILESTONE_ID: 1 + MILESTONE_ID: 80 # 2024.4 on: issues: From 24a394880f6cc63315827cbf7e553775475d3244 Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Fri, 2 Aug 2024 17:26:45 +1000 Subject: [PATCH 3/4] Update .github/workflows/assign-milestone-on-close.yml --- .github/workflows/assign-milestone-on-close.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/assign-milestone-on-close.yml b/.github/workflows/assign-milestone-on-close.yml index eb4336809e0..ecaa180aecd 100644 --- a/.github/workflows/assign-milestone-on-close.yml +++ b/.github/workflows/assign-milestone-on-close.yml @@ -1,7 +1,7 @@ name: Assign Milestone on Close env: - MILESTONE_ID: 80 # 2024.4 + MILESTONE_ID: ${{ secrets.MILESTONE_ID }} on: issues: From e552b429af8d55e21a76ac2651d01804d5cd4338 Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Fri, 2 Aug 2024 17:32:16 +1000 Subject: [PATCH 4/4] Update .github/workflows/assign-milestone-on-close.yml --- .github/workflows/assign-milestone-on-close.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/assign-milestone-on-close.yml b/.github/workflows/assign-milestone-on-close.yml index ecaa180aecd..a849caad70f 100644 --- a/.github/workflows/assign-milestone-on-close.yml +++ b/.github/workflows/assign-milestone-on-close.yml @@ -1,7 +1,7 @@ name: Assign Milestone on Close env: - MILESTONE_ID: ${{ secrets.MILESTONE_ID }} + MILESTONE_ID: ${{ vars.MILESTONE_ID }} on: issues: