Skip to content

Commit

Permalink
Update issue-autoamte.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
NsdHSO committed Aug 5, 2023
1 parent b1724df commit fae2c20
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/issue-autoamte.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ jobs:
steps:
- name: Check if PR is merged
id: pr_check
run: echo "::set-output name=is_merged::${{ github.event.pull_request.merged }}"
run: echo "is_merged=${{ github.event.pull_request.merged }}" >> $GITHUB_ENV

- name: Close Issue
if: ${{ steps.pr_check.outputs.is_merged == 'true' }}
if: ${{ env.pr_check == 'true' }}
run: |
# Extract the issue number from the pull request description
ISSUE_NUMBER=$(grep -oP '(?<=#)\d+' ${{ github.event.pull_request.body }} | head -n1)
ISSUE_NUMBER=$(grep -oP '(?<=#)\d+' "${{ github.event.pull_request.body }}" | head -n1)
# Close the referenced issue
if [[ $ISSUE_NUMBER ]]; then
echo "Closing Issue #$ISSUE_NUMBER"
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{"state": "closed"}' "https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER"
curl -X POST -H "Authorization: token ${{ secrets.GH_TOKEN }}" -d '{"state": "closed"}' "https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER"
else
echo "No referenced issue found in the pull request description."
fi

0 comments on commit fae2c20

Please sign in to comment.