From 0fdee0e487e17a1d69148d0d62018d31c6a4c7af Mon Sep 17 00:00:00 2001 From: Alexis Aguilar <98043211+alexisintech@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:04:47 -0700 Subject: [PATCH] feat(docs): post docs PRs to team-docs-alerts when ready for review (#53636) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem Not every docs PR gets posted in #team-docs, so some never get noticed by the docs team. Tracked in [DOCS-1683](https://linear.app/supabase/issue/DOCS-1683), the first stage of the docs PR review workflow project. ## Solution A new workflow, `.github/workflows/docs-pr-alert.yml`, posts a one-line message to #team-docs-alerts whenever a PR that changes `apps/docs/**` becomes ready for review: | What happens | Posts? | | --- | --- | | Opened as a draft | No | | Draft marked ready for review | Yes | | Opened as ready (not a draft) | Yes, when it's opened | | Ready, then draft, then ready again | Yes, each time it's marked ready | The message links the PR title and says whether the PR is internal or external (from a fork): ``` #00000 Add RLS examples to the auth guide · External ``` Key choices: - **`pull_request_target`** so fork PRs can read the webhook secret. The workflow only reads the event payload: it never checks out or runs PR code, and has `permissions: {}`. It's added to the zizmor `dangerous-triggers` allowlist alongside `external-pr-comment.yml` and the other `pull_request_target` workflows. - **Path filter instead of the `documentation` label**, because the labeler adds the label in a separate run and it may not be there yet when this runs. - **Reuses the existing `SLACK_DOCS_WEBHOOK_URL` secret** from `docs-master-alert.yml` (#53366), which already posts to #team-docs-alerts. No new Slack app or secret is needed. The workflow still skips quietly if the secret is missing. ## Review instructions 1. Read `.github/workflows/docs-pr-alert.yml` and confirm it never checks out or executes PR code. 2. Confirm the `zizmor.yml` change only adds this workflow to the allowlist. Checked locally with actionlint, zizmor 1.26.1 (same config as CI), and Prettier. ## Checklist Check all before review: - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 --- .github/workflows/docs-pr-alert.yml | 46 +++++++++++++++++++++++++++++ zizmor.yml | 1 + 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/docs-pr-alert.yml diff --git a/.github/workflows/docs-pr-alert.yml b/.github/workflows/docs-pr-alert.yml new file mode 100644 index 00000000000..8d6cf316684 --- /dev/null +++ b/.github/workflows/docs-pr-alert.yml @@ -0,0 +1,46 @@ +name: Post docs PRs to Slack + +# Posts a docs PR to #team-docs-alerts whenever it's ready for review: when +# it's opened as ready, and every time a draft is marked ready. Reuses the +# webhook from docs-master-alert.yml. +# pull_request_target is used so fork PRs can read the webhook secret. This +# workflow only reads the event payload. It never checks out or runs PR code. +on: + pull_request_target: + types: [opened, ready_for_review] + paths: + - 'apps/docs/**' + +permissions: {} + +jobs: + post-to-slack: + runs-on: ubuntu-latest + if: github.event.pull_request.draft == false + steps: + - name: Post to Slack + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DOCS_WEBHOOK_URL }} + with: + script: | + const webhookUrl = process.env.SLACK_WEBHOOK_URL + if (!webhookUrl) { + core.notice('SLACK_DOCS_WEBHOOK_URL is not set, skipping.') + return + } + + const pr = context.payload.pull_request + const isExternal = !pr.head.repo || pr.head.repo.full_name !== pr.base.repo.full_name + const escape = (text) => + text.replace(/&/g, '&').replace(//g, '>') + const text = `<${pr.html_url}|#${pr.number} ${escape(pr.title)}> · ${isExternal ? 'External' : 'Internal'}` + + const response = await fetch(webhookUrl, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ text, unfurl_links: false }), + }) + if (!response.ok) { + core.setFailed(`Slack returned ${response.status}: ${await response.text()}`) + } diff --git a/zizmor.yml b/zizmor.yml index 8c80c2129ba..978f031f959 100644 --- a/zizmor.yml +++ b/zizmor.yml @@ -3,6 +3,7 @@ rules: ignore: - 'authorize-vercel-deploys.yml' - 'docs-master-alert.yml' + - 'docs-pr-alert.yml' - 'external-pr-comment.yml' - 'kb-master-alert.yml' - 'label_prs.yml'