-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: cuisongliu <[email protected]>
- Loading branch information
1 parent
c199ebe
commit fd17418
Showing
2 changed files
with
48 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: 'Add cherry-pick comment when PR is merged' | ||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
comment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Comment cherry-pick command | ||
uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
const pr = context.payload.pull_request; | ||
if (!pr.merged) { | ||
console.log("PR is not merged. Skipping..."); | ||
return; | ||
} | ||
if (!pr.milestone || !pr.milestone.title) { | ||
console.log("Milestone is not set. Skipping..."); | ||
return; | ||
} | ||
const milestone = pr.milestone.title; | ||
const cherryPickCmd = `/cherry-pick ${milestone}-release`; | ||
console.log(`Adding comment: ${cherryPickCmd}`); | ||
await github.rest.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: pr.number, | ||
body: cherryPickCmd | ||
}); | ||
github-token: ${{ secrets.GH_PAT }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters