diff --git a/.github/workflows/discord-dev-feed.yml b/.github/workflows/discord-dev-feed.yml new file mode 100644 index 00000000..1bf872d9 --- /dev/null +++ b/.github/workflows/discord-dev-feed.yml @@ -0,0 +1,40 @@ +name: Discord dev feed + +on: + issues: + types: [opened, closed, reopened] + issue_comment: + types: [created] + pull_request_target: + types: [opened, closed, reopened] + pull_request_review: + types: [submitted] + pull_request_review_comment: + types: [created] + discussion: + types: [created] + discussion_comment: + types: [created] + +permissions: {} + +jobs: + relay: + if: >- + github.event.sender.type != 'Bot' && + (github.event.pull_request.user.type || github.event.issue.user.type || 'User') != 'Bot' + runs-on: ubuntu-latest + steps: + - name: Forward the event to the family channel + env: + WEBHOOK: ${{ secrets.DISCORD_DEV_FEED_WEBHOOK }} + EVENT: ${{ github.event_name == 'pull_request_target' && 'pull_request' || github.event_name }} + run: | + if [ -z "$WEBHOOK" ]; then + echo "::notice::DISCORD_DEV_FEED_WEBHOOK is not available to this run (fork pull request or unset secret); skipping" + exit 0 + fi + curl -fsS -X POST "$WEBHOOK/github" \ + -H "Content-Type: application/json" \ + -H "X-GitHub-Event: $EVENT" \ + --data-binary "@$GITHUB_EVENT_PATH"