Skip to content

fix: url query filters #11

fix: url query filters

fix: url query filters #11

name: Close Issue on PR Merge
on:
pull_request:
types: [closed]
jobs:
close-issue:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check for issue reference
run: |
ISSUE_NUMBER=$(echo "${{ github.event.pull_request.body }}" | grep -oP '(?<=#)\d+')
echo "Issue number: $ISSUE_NUMBER"
if [ -n "$ISSUE_NUMBER" ]; then
echo "Closing issue #$ISSUE_NUMBER"
curl -X PATCH \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER \
-d '{"state":"closed"}'
else
echo "No issue referenced in the PR description"
fi