내가 만든 크루 페이지에서 크루 상세 페이지로 이동할 수 있는 기능 #141
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 |