From 0118fd46e8b80f4737ab85de326ae0586d6a513b Mon Sep 17 00:00:00 2001 From: jungsunbeen Date: Fri, 30 May 2025 00:35:43 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20PR=EC=9D=B4=20=EB=8B=AB=ED=9E=90=20?= =?UTF-8?q?=EB=95=8C=20=EC=B2=B4=ED=81=AC=EB=A6=AC=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EA=B0=80=20=EC=99=84=EB=A3=8C=EB=90=9C=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?=EC=96=B8=EA=B8=89=EB=90=9C=20=EC=9D=B4=EC=8A=88=20=EC=9E=90?= =?UTF-8?q?=EB=8F=99=20=EB=8B=AB=EA=B8=B0=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/closed-issue.yml | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/closed-issue.yml diff --git a/.github/workflows/closed-issue.yml b/.github/workflows/closed-issue.yml new file mode 100644 index 0000000..375418c --- /dev/null +++ b/.github/workflows/closed-issue.yml @@ -0,0 +1,41 @@ +name: Close Mentioned Issues if Checklist Complete + +on: + pull_request: + types: [closed] + +permissions: + issues: write + pull-requests: read + contents: read + +jobs: + close-mentioned-issues: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - name: Check if checklist is fully complete + id: checklist + run: | + BODY="${{ github.event.pull_request.body }}" + UNCHECKED=$(echo "$BODY" | grep -c '\[ \]') + if [ "$UNCHECKED" -eq 0 ]; then + echo "checklist-complete=true" >> $GITHUB_OUTPUT + else + echo "checklist-complete=false" >> $GITHUB_OUTPUT + fi + + - name: Extract issue numbers + id: issues + run: | + BODY="${{ github.event.pull_request.body }}" + echo "ISSUES=$(echo "$BODY" | grep -oE '#[0-9]+' | tr -d '#' | tr '\n' ' ')" >> $GITHUB_OUTPUT + + - name: Close mentioned issues + if: steps.checklist.outputs.checklist-complete == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + for issue in ${{ steps.issues.outputs.ISSUES }}; do + gh issue close "$issue" --repo "${{ github.repository }}" + done