마이페이지 api요청 수정 #80
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 associated issue | |
on: | |
pull_request: | |
branches: | |
- dev | |
types: | |
- closed | |
jobs: | |
close-issue: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Close associated issue | |
run: | | |
PR_NUMBER=${{ github.event.pull_request.number }} | |
PR_URL="https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER" | |
echo "PR_URL: $PR_URL" | |
PR_BODY=$(curl -s -H "Authorization: token ${{ secrets.ACTION_TOKEN }}" $PR_URL | jq -r '.body') | |
echo "PR_BODY: $PR_BODY" | |
ISSUE_NUMBER=$(echo $PR_BODY | grep -oE "close #[0-9]+" | tr -d 'close #') | |
echo "ISSUE_NUMBER: $ISSUE_NUMBER" | |
if [[ ! -z "$ISSUE_NUMBER" ]]; then | |
curl -s -H "Authorization: token ${{ secrets.ACTION_TOKEN }}" -X PATCH "https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER" -d '{"state": "closed"}' | |
fi | |
shell: bash |