-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1120 from wakmusic/1112-none-develop-branch-suppo…
…rt-auto-close-linked-issue 🔀 :: (#1112) develop이 아닌 브랜치를 대상으로 PR 머지 시 연관된 이슈 자동으로 close
- Loading branch information
Showing
5 changed files
with
79 additions
and
0 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
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,5 @@ | ||
FROM node:20.14 | ||
|
||
COPY . . | ||
|
||
CMD [ "node", "/main.js"] |
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,16 @@ | ||
name: "Auto_close_associate_issue" | ||
|
||
description: "Auto close an issue which associate with a PR." | ||
|
||
inputs: | ||
prbody: | ||
description: "The body of the PR to search for related issues" | ||
required: true | ||
|
||
outputs: | ||
issurNumber: | ||
description: "The issue number" | ||
|
||
runs: | ||
using: "docker" | ||
image: "Dockerfile" |
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,16 @@ | ||
let body = process.env["INPUT_PRBODY"]; | ||
|
||
/* | ||
PR Template의 resolved issue 넘버 표기 방식 변경 시 해당 코드 또한 변경 필요 | ||
*/ | ||
let pattern = /Resolves: #\d+/; | ||
|
||
let issueNumber; | ||
|
||
try { | ||
issueNumber = body.match(pattern)[0].replace("Resolves: #", ""); | ||
} catch { | ||
issueNumber = -1; | ||
} | ||
|
||
console.log(`::set-output name=issueNumber::${issueNumber}`); |
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,32 @@ | ||
name: Auto close issue when PR is merged | ||
|
||
on: | ||
pull_request_target: | ||
branches-ignore: ["develop"] | ||
types: [closed] | ||
paths: | ||
- "**/*.swift" | ||
|
||
jobs: | ||
close-issue: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == true || github.event.action != 'closed' | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run Auto issue closer | ||
uses: ./.github/actions/Auto_close_associate_issue/ | ||
id: Closer | ||
with: | ||
prbody: ${{ github.event.pull_request.body }} | ||
|
||
- name: Close Issue | ||
uses: peter-evans/close-issue@v2 | ||
if: ${{ github.event.pull_request.merged }} | ||
with: | ||
issue-number: ${{ steps.Closer.outputs.issueNumber }} | ||
comment: The associated PR has been merged, this issue is automatically closed, you can reopend if necessary. \#${{ github.event.pull_request.number }} | ||
env: | ||
Github_Token: ${{ secrets.GITHUB_TOKEN }} | ||
PRNUM: ${{ github.event.pull_request.number }} |