Open a docs follow-up when a PR merges with the needs-docs label

By General Input

When a pull request tagged needs-docs gets merged, stage a GitBook draft, alert the docs channel in Slack, and link both sides so nothing slips.

Integrations

  • GitHub
  • GitBook
  • Slack Bot

Type

Deterministic Code

Categories

  • Engineering
  • Operations

Build me a code workflow that closes the docs-drift loop between engineering and our docs team. Every step is deterministic input-to-output mapping, no model calls.

Trigger: a GitHub webhook on the pull_request event. Only continue when action is closed AND the payload's pull_request.merged is true AND the pull_request.labels array contains a configurable label name (default: needs-docs). Drop everything else.

Step 1. Use GitHub Get a Pull Request with the owner, repo, and pull number from the webhook payload. Capture title, body, user.login (the author), html_url (the link back to the merged PR), and number.

Step 2. Use GitBook Create Change Request in a configurable GitBook space (expose spaceId as a workflow input). Set the subject to the PR title. Set the description to the PR body followed by a 'Source PR' line linking back to the merged PR's html_url so a writer has the source context. Capture the returned change request URL.

Step 3. Use Slack Bot Send a Message to a configurable Slack channel (default #docs-followups). Format the message in Slack mrkdwn and include the PR title, the author's GitHub handle, a link to the merged PR, and a link to the GitBook change request. Example shape: '*Docs follow-up needed*: <pr_url|PR title> by @author. Draft: <cr_url|Open in GitBook>'.

Step 4. Use GitHub Create an Issue Comment on the same PR number (the issues endpoint also covers PR comments) with a short message like 'Docs follow-up staged: <gitbook_url>'. That gives engineering a paper trail directly on the merged PR.

Workflow inputs to expose: the GitHub repository (owner/repo), the label name (default needs-docs), the GitBook spaceId, and the Slack channel id or name. Everything else flows from the webhook payload and the API responses.

Related prompts

Explore more prompts
A brand asset library your marketing team actually searchesTurn Mailjet email clicks into ranked HubSpot follow-upsClean out the Looker dashboards and Looks nobody opensLiveKit live operations console for room moderationWake up dormant Keap leads with a researched reasonLiveChat coverage board for planning next week's shiftsPhone routing control panel for LiveKit voice agentsLinkedIn Ads budget pacing dashboard for every client accountGive your team Looker numbers without buying more seatsPause marketing emails to escalated customers, then restore them