mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-25 23:41:30 -06:00
bc213d34d9
remove ::set-output usage remove `$version` asc a enviroment variable as ot's not used
31 lines
1.0 KiB
YAML
31 lines
1.0 KiB
YAML
name: Close Discussion on PR Merge
|
|
|
|
on:
|
|
pull_request:
|
|
types: [closed]
|
|
|
|
jobs:
|
|
closeDiscussion:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check if PR was merged
|
|
if: github.event.pull_request.merged == true
|
|
run: echo "PR was merged"
|
|
|
|
- name: Extract Discussion Number
|
|
if: github.event.pull_request.merged == true
|
|
id: extract-discussion
|
|
run: |
|
|
echo "discussion=$(echo '${{ github.event.pull_request.body }}' | grep -oP '(?<=Resolves #)\d+')" >> $GITHUB_OUTPUT
|
|
shell: bash
|
|
|
|
- name: Close the discussion
|
|
if: github.event.pull_request.merged == true && steps.extract-discussion.outputs.discussion
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
DISCUSSION_ID: ${{ steps.extract-discussion.outputs.discussion }}
|
|
run: |
|
|
curl -X PATCH -H "Authorization: token $GITHUB_TOKEN" \
|
|
-d '{"state": "closed"}' \
|
|
"https://api.github.com/repos/${{ github.repository }}/discussions/${DISCUSSION_ID}"
|