-
Notifications
You must be signed in to change notification settings - Fork 0
184 lines (167 loc) · 8.13 KB
/
Copy pathrelease-note-to-docs-pr.yml
File metadata and controls
184 lines (167 loc) · 8.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: release-note-to-docs-pr
# ─────────────────────────────────────────────────────────────────────────────
# Turns a changed release note in snippyly/internal-release-notes into a docs PR
# by running the committed 7-agent pipeline through deterministic checkpoints.
#
# Triggered by a repository_dispatch (type: new-release-note) sent from the
# source repo's notify-docs-on-release-note.yml. Also runnable manually via
# workflow_dispatch for dry runs, forced reruns, and resume testing.
#
# Mirrors .github/workflows/docs-sync-skills.yml (cross-repo checkout via
# CROSS_REPO_PAT, headless Claude via ANTHROPIC_API_KEY, fail-loud notify).
# ─────────────────────────────────────────────────────────────────────────────
on:
repository_dispatch:
types: [new-release-note]
workflow_dispatch:
inputs:
path:
description: "Release-note path within the source repo, e.g. release-notes/v6.0.0-beta.2.md"
required: false
type: string
release_note_url:
description: "GitHub blob/raw URL to a release note. URL runs default to resume mode."
required: false
type: string
sha:
description: "Source repo commit SHA/ref to read the note from. Overrides the ref parsed from release_note_url."
required: false
type: string
change_type:
description: "Source change type: added, modified, renamed, or deleted."
required: false
default: added
type: choice
options:
- added
- modified
- renamed
- deleted
mode:
description: "auto skips completed work, resume continues checkpoints, force reruns all stages."
required: false
default: resume
type: choice
options:
- auto
- resume
- force
dry_run:
description: "Classify and print route without branch, PR, or agent side effects."
required: false
default: false
type: boolean
# Default notes get a per-note group; shared-firebase-function notes share one
# group so concurrent appends can't race-push the same release branch.
concurrency:
group: >-
${{ contains(github.event.client_payload.path || inputs.path || github.event.client_payload.release_note_url || inputs.release_note_url, 'shared-firebase-function')
&& 'rn2docs-firebase-append'
|| format('rn2docs-{0}', github.event.client_payload.path || inputs.path || github.event.client_payload.release_note_url || inputs.release_note_url || github.run_id) }}
cancel-in-progress: false # never cancel a running pipeline — risk of a partial PR
permissions:
contents: read
env:
DOCS_REPO: velt-js/docs
NOTE_REPO: snippyly/internal-release-notes
jobs:
run-pipeline:
name: Run pipeline & open PR
runs-on: ubuntu-latest
timeout-minutes: 350 # the full 7-agent pipeline is long; GH job ceiling is 6h
steps:
- name: Checkout docs (full history)
uses: actions/checkout@v4
with:
repository: velt-js/docs
ref: main
fetch-depth: 0
token: ${{ secrets.CROSS_REPO_PAT }}
path: docs
- name: Resolve inputs
id: inputs
env:
CLIENT_PAYLOAD_PATH: ${{ github.event.client_payload.path }}
CLIENT_PAYLOAD_RELEASE_NOTE_URL: ${{ github.event.client_payload.release_note_url }}
CLIENT_PAYLOAD_SHA: ${{ github.event.client_payload.sha }}
CLIENT_PAYLOAD_CHANGE_TYPE: ${{ github.event.client_payload.change_type }}
CLIENT_PAYLOAD_SOURCE_REPO: ${{ github.event.client_payload.source_repo }}
CLIENT_PAYLOAD_MODE: ${{ github.event.client_payload.mode }}
CLIENT_PAYLOAD_DRY_RUN: ${{ github.event.client_payload.dry_run }}
INPUT_PATH: ${{ inputs.path }}
INPUT_RELEASE_NOTE_URL: ${{ inputs.release_note_url }}
INPUT_SHA: ${{ inputs.sha }}
INPUT_CHANGE_TYPE: ${{ inputs.change_type }}
INPUT_SOURCE_REPO: snippyly/internal-release-notes
INPUT_MODE: ${{ inputs.mode }}
INPUT_DRY_RUN: ${{ inputs.dry_run }}
run: bash docs/scripts/release-notes/resolve-release-note-input.sh
- name: Checkout source release-notes repo
uses: actions/checkout@v4
with:
repository: ${{ steps.inputs.outputs.source_repo }}
ref: ${{ steps.inputs.outputs.note_ref || 'main' }}
fetch-depth: 1
token: ${{ secrets.CROSS_REPO_PAT }}
path: source
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install claude-code CLI
run: npm install -g @anthropic-ai/claude-code
- name: Verify Claude Code supports Opus 4.8
run: |
set -euo pipefail
VERSION="$(claude --version | awk '{print $1}')"
REQUIRED="2.1.154"
if [ "$(printf '%s\n%s\n' "$REQUIRED" "$VERSION" | sort -V | head -n1)" != "$REQUIRED" ]; then
echo "::error::Claude Code $VERSION is too old for claude-opus-4-8. Install v2.1.154 or newer."
exit 1
fi
echo "Claude Code $VERSION supports claude-opus-4-8."
- name: Configure git identity (docs)
working-directory: docs
run: |
git config user.name "release-notes-bot"
git config user.email "release-notes-bot@users.noreply.github.com"
- name: Run release-note pipeline
working-directory: docs
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GH_TOKEN: ${{ secrets.CROSS_REPO_PAT }}
NOTE_REPO: ${{ env.NOTE_REPO }}
SOURCE_REPO: ${{ steps.inputs.outputs.source_repo }}
SOURCE_SHA: ${{ steps.inputs.outputs.note_ref }}
SOURCE_NOTE_URL: ${{ steps.inputs.outputs.source_note_url }}
CHANGE_TYPE: ${{ steps.inputs.outputs.change_type }}
NOTE_PATH: ${{ steps.inputs.outputs.note_path }}
SOURCE_DIR: ${{ github.workspace }}/source
PIPELINE_MODE: ${{ steps.inputs.outputs.pipeline_mode }}
PIPELINE_DRY_RUN: ${{ steps.inputs.outputs.pipeline_dry_run }}
PIPELINE_MODEL: claude-opus-4-8
AGENT_MAX_TURNS: "100"
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
DOCS_REPO: ${{ env.DOCS_REPO }}
SLACK_WEBHOOK_URL: ${{ secrets.DOCS_AUTOMATION_SLACK_WEBHOOK_URL }}
ANTHROPIC_DEFAULT_OPUS_MODEL: claude-opus-4-8
run: bash scripts/release-notes/run-release-note-pipeline.sh
- name: Notify on failure (never fail silently)
if: failure()
env:
GH_TOKEN: ${{ secrets.CROSS_REPO_PAT }}
run: |
if [ -f "${RUNNER_TEMP}/release-note-failure-notified" ]; then
echo "Release-note runner already posted failure notification:"
cat "${RUNNER_TEMP}/release-note-failure-notified"
exit 0
fi
NOTE_PATH="${{ steps.inputs.outputs.note_path || inputs.path || inputs.release_note_url || github.event.client_payload.path || github.event.client_payload.release_note_url }}"
NOTE_URL="${{ steps.inputs.outputs.source_note_url || inputs.release_note_url || github.event.client_payload.release_note_url }}"
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
MSG="⚠️ release-note → docs PR pipeline failed for \`${NOTE_PATH}\`. No docs PR was produced. Pipeline run: ${RUN_URL}. Rerun with release_note_url: ${NOTE_URL:-unavailable} — @yoen-velt"
# Surface the failure as an issue on the docs repo so it is never dropped.
gh issue create --repo velt-js/docs \
--title "release-note pipeline failed: ${NOTE_PATH}" \
--body "$MSG" \
--label documentation || true