[BE] main λΈλμΉμ μΆ©λ ν΄κ²° #48
Workflow file for this run
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
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 }}" |