Skip to content

[BE] main λΈŒλžœμΉ˜μ™€ 좩돌 ν•΄κ²° #48

[BE] main λΈŒλžœμΉ˜μ™€ 좩돌 ν•΄κ²°

[BE] main λΈŒλžœμΉ˜μ™€ 좩돌 ν•΄κ²° #48

Workflow file for this run

name: Close Issue on PR Merge
on:
pull_request:
types: [closed]
jobs:
close-issue:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Extract issue number from PR body
id: extract_issue
run: |
# Fetch PR body
PR_BODY=$(curl -s -H "Authorization: token ${{ secrets.CONFIG_SUBMODULE_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}" \
| jq -r '.body')
# Extract issue number from PR body using regex (customize if needed)
ISSUE_NUMBER=$(echo "$PR_BODY" | grep -oP '#\d+' | head -1 | sed 's/#//')
echo "ISSUE_NUMBER=$ISSUE_NUMBER" >> $GITHUB_ENV
- name: Close associated issue
if: env.ISSUE_NUMBER != ''
run: |
echo "Closing issue #${{ env.ISSUE_NUMBER }}"
curl -s -X PATCH -H "Authorization: token ${{ secrets.CONFIG_SUBMODULE_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '{"state": "closed"}' \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ env.ISSUE_NUMBER }}"