Add milestone to a closed issue that has a merged PR fix automatically (#14131)

<!--
if this PR closes one or more issues, you can automatically link the PR
with
them by using one of the [*linking
keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword),
e.g.
- this PR should close #xxxx
- fixes #xxxx

you can also mention related issues, PRs or discussions!
-->

# Description

Use https://github.com/marketplace/actions/milestone-action to add
milestone to a closed issue that has a merged PR fix automatically
This commit is contained in:
Justin Ma 2024-10-20 10:45:05 +08:00 committed by GitHub
parent e911ff4d67
commit 8812072f06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,8 +1,11 @@
# Description: # 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 name: Milestone Action
on: on:
issues:
types: [closed]
pull_request_target: pull_request_target:
types: [closed] types: [closed]
@ -10,9 +13,18 @@ jobs:
update-milestone: update-milestone:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Milestone Update name: Milestone Update
if: ${{github.event.pull_request.merged == true}}
steps: steps:
- name: Set Milestone - name: Set Milestone for PR
uses: hustcer/milestone-action@main 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: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}