Process discussions #11
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: Process discussions | |
on: | |
discussion: | |
types: [created] | |
permissions: | |
discussions: write | |
jobs: | |
transfer: | |
name: Close transfer requests | |
runs-on: ubuntu-latest | |
if: >- | |
github.event.repository.name == '.github' && | |
github.event.discussion.category.name == 'Transfer' | |
steps: | |
- name: Post comment | |
uses: octokit/[email protected] | |
with: | |
query: | | |
mutation comment($comment: String!, $nodeid: ID!) { | |
addDiscussionComment(input: { | |
body: $comment, | |
discussionId: $nodeid | |
}) { | |
clientMutationId | |
comment { id } | |
} | |
} | |
variables: | | |
nodeid: ${{github.event.discussion.node_id}} | |
comment: "${{vars.TRANSFER_CLOSE_COMMENT}}" | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Close discussion | |
uses: octokit/[email protected] | |
with: | |
query: | | |
mutation close($nodeid: ID!) { | |
closeDiscussion(input: { | |
discussionId: $nodeid, | |
reason: OUTDATED | |
}) { | |
clientMutationId | |
} | |
} | |
variables: | | |
nodeid: ${{github.event.discussion.node_id}} | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |