Skip to content

Commit 69692b6

Browse files
authored
[GHES release note automation] Change the author of auto-comments on release issues to docs-bot (#60817)
1 parent 9c0ebd8 commit 69692b6

File tree

5 files changed

+386
-47
lines changed

5 files changed

+386
-47
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Notify release PMs
2+
3+
# **What it does**: Posts review notification comments on release issues
4+
# in github/releases for generated GHES release notes.
5+
# **Why we have it**: So comments are always posted by docs-bot, without
6+
# needing to distribute a PAT to individual team members.
7+
# **Who does it impact**: Docs content (GHES release DRIs).
8+
9+
on:
10+
workflow_dispatch:
11+
inputs:
12+
release:
13+
description: 'GHES release version (e.g., 3.21)'
14+
type: string
15+
required: true
16+
pr:
17+
description: 'docs-internal PR number containing the release notes'
18+
type: string
19+
required: true
20+
release_type:
21+
description: 'Release type (auto-detects from files if not specified)'
22+
type: choice
23+
options:
24+
- auto
25+
- rc
26+
- ga
27+
default: 'auto'
28+
review_date:
29+
description: 'Override review deadline (YYYY-MM-DD, optional)'
30+
type: string
31+
required: false
32+
dry_run:
33+
description: 'Preview comments in the workflow log without posting them'
34+
type: boolean
35+
default: false
36+
37+
permissions:
38+
contents: read
39+
40+
jobs:
41+
notify:
42+
name: Notify release PMs
43+
if: github.repository == 'github/docs-internal'
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Checkout repository code
47+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
48+
49+
- uses: ./.github/actions/node-npm-setup
50+
51+
- name: Post notification comments
52+
env:
53+
DOCS_BOT_PAT_BASE: ${{ secrets.DOCS_BOT_PAT_BASE }}
54+
INPUT_RELEASE: ${{ inputs.release }}
55+
INPUT_PR: ${{ inputs.pr }}
56+
INPUT_RELEASE_TYPE: ${{ inputs.release_type }}
57+
INPUT_REVIEW_DATE: ${{ inputs.review_date }}
58+
INPUT_DRY_RUN: ${{ inputs.dry_run }}
59+
run: |
60+
args=(--release "$INPUT_RELEASE" --pr "$INPUT_PR")
61+
62+
if [[ "$INPUT_RELEASE_TYPE" == "rc" ]]; then
63+
args+=(--rc)
64+
elif [[ "$INPUT_RELEASE_TYPE" == "ga" ]]; then
65+
args+=(--ga)
66+
fi
67+
68+
if [[ -n "$INPUT_REVIEW_DATE" ]]; then
69+
args+=(--review-date "$INPUT_REVIEW_DATE")
70+
fi
71+
72+
if [[ "$INPUT_DRY_RUN" == "true" ]]; then
73+
args+=(--dry-run)
74+
fi
75+
76+
npm run notify-release-pms -- "${args[@]}"

src/ghes-releases/scripts/README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,28 @@ npm run generate-release-notes -- --release 3.21 --force
7171

7272
After you open a pull request with the generated notes, this script posts a review comment on each source issue in `github/releases`. The comment asks the PM to review their note in the docs PR and react with 🚀 when they approve.
7373

74+
Comments are always posted by the `docs-bot` account.
75+
76+
### Running via GitHub Actions (recommended)
77+
78+
The easiest way to run this is via the **Notify release PMs** workflow, which handles authentication automatically:
79+
7480
```bash
75-
npm run notify-release-pms -- --release <version> --pr <number> [options]
81+
# From the CLI
82+
gh workflow run notify-release-pms.yml -f release=3.21 -f pr=12345
83+
84+
# With options
85+
gh workflow run notify-release-pms.yml -f release=3.21 -f pr=12345 -f release_type=rc -f review_date=2026-04-25
86+
```
87+
88+
You can also trigger it from the [Actions tab](https://github.com/github/docs-internal/actions/workflows/notify-release-pms.yml).
89+
90+
### Previewing locally (dry run)
91+
92+
You can preview comments locally without any token:
93+
94+
```bash
95+
npm run notify-release-pms -- --release 3.21 --pr 12345 --dry-run
7696
```
7797

7898
### Options
@@ -155,7 +175,7 @@ npm run check-release-approvals -- --release 3.21 --json
155175
1. **Generate notes:** `npm run generate-release-notes -- --release 3.21 --rc`
156176
2. **Review the output** in `data/release-notes/enterprise-server/3-21/0-rc1.yml`—clean up any TODO placeholders or unknown headings.
157177
3. **Open a draft PR** with the generated file.
158-
4. **Notify PMs:** `npm run notify-release-pms -- --release 3.21 --rc --pr <PR_NUMBER>`
178+
4. **Notify PMs:** `gh workflow run notify-release-pms.yml -f release=3.21 -f pr=<PR_NUMBER> -f release_type=rc`
159179
5. **Wait for approvals.** PMs react with 🚀 on their release issues.
160180
6. **Check status:** `npm run check-release-approvals -- --release 3.21 --rc`
161181
7. Once all approved, finalize the PR.

src/ghes-releases/scripts/check-release-approvals.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import fs from 'fs'
1414
import path from 'path'
1515
import ora from 'ora'
1616

17+
import { buildMarker } from '@/ghes-releases/scripts/notify-release-pms'
18+
1719
// ─── Types ───────────────────────────────────────────────────────────────────
1820

1921
interface ApprovalStatus {
@@ -195,7 +197,7 @@ program
195197
// ── Step 2: Check each issue ──
196198
const isRc = yamlPath === rcPath
197199
const releaseType = isRc ? 'rc' : 'ga'
198-
const marker = `<!-- ghes-release-note-review: ${release}-${releaseType} -->`
200+
const marker = buildMarker(release, releaseType)
199201
const statuses: ApprovalStatus[] = []
200202

201203
for (let i = 0; i < issueNumbers.length; i++) {

0 commit comments

Comments
 (0)