New Discussion Auto-lock #88
This file contains hidden or 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: New Discussion Auto-lock | |
| # automatically lock and close new discussion posts | |
| on: | |
| discussion: | |
| types: [created] | |
| jobs: | |
| lock_discussion: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Close and lock discussion | |
| run: | | |
| lockSucceeded="$(gh api graphql -F discussionId=$DISCUSSION_ID -f query=' | |
| mutation lock($discussionId:ID!) { | |
| addDiscussionComment(input:{discussionId:$discussionId, body:"This discussion was automatically closed because the community moved to [community.vercel.com](https://community.vercel.com)"}) { | |
| comment{ | |
| url | |
| } | |
| } | |
| closeDiscussion(input: {discussionId:$discussionId, reason: OUTDATED}) { | |
| discussion { | |
| url | |
| stateReason | |
| } | |
| } | |
| lockLockable(input: {lockableId:$discussionId}) { | |
| actor { | |
| login | |
| } | |
| lockedRecord { | |
| activeLockReason | |
| locked | |
| } | |
| } | |
| } | |
| ' --jq '.data.lockLockable.lockedRecord.locked')" | |
| echo "LOCKED =" $lockSucceeded | |
| echo '${{ github.event.discussion.number }}' | jq -r '"https://github.com/vercel/vercel/discussions/\(.)"' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| DISCUSSION_ID: ${{ github.event.discussion.node_id }} |