diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 85c369b67..c65464a91 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,26 +1,36 @@ ## πŸ’‘ λ°°κ²½ 및 κ°œμš” + + + Resolves: #{이슈번호} ## πŸ“ƒ μž‘μ—…λ‚΄μš© + ## πŸ™‹β€β™‚οΈ λ¦¬λ·°λ…ΈνŠΈ + ## βœ… PR 체크리슀트 + - [ ] 이 μž‘μ—…μœΌλ‘œ 인해 변경이 ν•„μš”ν•œ λ¬Έμ„œκ°€ λ³€κ²½λ˜μ—ˆλ‚˜μš”? (e.g. `XCConfig`, `λ…Έμ…˜`, `README`) - [ ] 이 μž‘μ—…μ„ ν•˜κ³ λ‚˜μ„œ κ³΅μœ ν•΄μ•Όν•  νŒ€μ›λ“€μ—κ²Œ κ³΅μœ λ˜μ—ˆλ‚˜μš”? (e.g. `"API 개발 μ™„λ£Œλμ–΄μš”"`, `"XCConfig κ°’ μΆ”κ°€λ˜μ—ˆμ–΄μš”"`) diff --git a/.github/actions/Auto_close_associate_issue/Dockerfile b/.github/actions/Auto_close_associate_issue/Dockerfile new file mode 100644 index 000000000..9fa45294b --- /dev/null +++ b/.github/actions/Auto_close_associate_issue/Dockerfile @@ -0,0 +1,5 @@ +FROM node:20.14 + +COPY . . + +CMD [ "node", "/main.js"] \ No newline at end of file diff --git a/.github/actions/Auto_close_associate_issue/action.yml b/.github/actions/Auto_close_associate_issue/action.yml new file mode 100644 index 000000000..729630a2b --- /dev/null +++ b/.github/actions/Auto_close_associate_issue/action.yml @@ -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" \ No newline at end of file diff --git a/.github/actions/Auto_close_associate_issue/main.js b/.github/actions/Auto_close_associate_issue/main.js new file mode 100644 index 000000000..850877d2f --- /dev/null +++ b/.github/actions/Auto_close_associate_issue/main.js @@ -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}`); diff --git a/.github/workflows/AutoCloseIssueByPullRequest.yml b/.github/workflows/AutoCloseIssueByPullRequest.yml new file mode 100644 index 000000000..c01b7fefe --- /dev/null +++ b/.github/workflows/AutoCloseIssueByPullRequest.yml @@ -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 }}