From 8812072f065be283df3e9a81f3945d0364f2f247 Mon Sep 17 00:00:00 2001 From: Justin Ma Date: Sun, 20 Oct 2024 10:45:05 +0800 Subject: [PATCH] Add milestone to a closed issue that has a merged PR fix automatically (#14131) # Description Use https://github.com/marketplace/actions/milestone-action to add milestone to a closed issue that has a merged PR fix automatically --- .github/workflows/milestone.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/milestone.yml b/.github/workflows/milestone.yml index 1897f2f617..7a4d483ee1 100644 --- a/.github/workflows/milestone.yml +++ b/.github/workflows/milestone.yml @@ -1,8 +1,11 @@ # Description: -# - Update milestone of a merged PR +# - Add milestone to a merged PR automatically +# - Add milestone to a closed issue that has a merged PR fix (if any) name: Milestone Action on: + issues: + types: [closed] pull_request_target: types: [closed] @@ -10,9 +13,18 @@ jobs: update-milestone: runs-on: ubuntu-latest name: Milestone Update - if: ${{github.event.pull_request.merged == true}} steps: - - name: Set Milestone + - name: Set Milestone for PR uses: hustcer/milestone-action@main + if: github.event.pull_request.merged == true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # Bind milestone to closed issue that has a merged PR fix + - name: Set Milestone for Issue + uses: hustcer/milestone-action@main + if: github.event.issue.state == 'closed' + with: + action: bind-issue env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}