GitHub Release

GitHub Release

Guides an AI agent through releasing a new GitHub library version: analysing commits, choosing a SemVer bump, writing a Keep a Changelog entry and opening a release pull request.

Skill files3 files

references/

SKILL.md442 lines
1
---
2
name: github-release
3
description: >
4
Guides IA through releasing a new version of a GitHub library end-to-end.
5
Handles SemVer versioning and Keep a Changelog formatting automatically.
6
compatibility: "requires: gh CLI and git"
7
---
8
9
# GitHub Release Skill
10
11
This skill automates the full release workflow for a single-package GitHub repository,
12
from analysis through changelog authoring and PR creation. It relies exclusively on
13
`gh` (GitHub CLI) and `git` no other tools needed.
14
15
Steps 1 - 4 are **read-only reconnaissance** nothing is written to the repo until
16
Step 5, once the version number is confirmed.
17
18
## When to Use This Skill
19
20
Use this skill whenever the user wants to cut a new release, publish a new version,
21
bump a version, create a release branch, generate a changelog, or open a release PR
22
on a GitHub repository. Trigger even if the user says something casual like "let's
23
ship a new version" or "time to release".
24
25
---
26
27
## Prerequisites
28
29
Examples below include both Bash and PowerShell variants; Windows users should prefer
30
the PowerShell blocks.
31
32
Before starting, verify the environment:
33
34
```bash
35
gh auth status # must be authenticated
36
gh repo view --json nameWithOwner # must be inside a GitHub repo
37
git status # working tree should be clean
38
```
39
40
If any check fails, stop and tell the user what to fix before continuing.
41
42
Then ask the user one question:
43
44
> *"Which directory contains your library's public-facing source code?
45
> (e.g. `src/`, `lib/`, `pkg/` - used to focus the diff on what consumers
46
> actually see. Press Enter to scan the whole repo.)"*
47
48
Store the answer as `PUBLIC_PATH`. If empty, `PUBLIC_PATH` is `.` (repo root).
49
Exclude these paths from all diffs regardless: `tests/`, `test/`, `spec/`,
50
`__tests__/`, `docs/`, `*.lock`, `*-lock.json`, `*.sum`, generated files
51
(files with a "do not edit" header comment), and build artefacts.
52
53
---
54
55
## The 9-Step Release Workflow
56
57
Work through every step in order. Show the user what command you're about to run and
58
its output. Pause and ask for confirmation only when explicitly noted.
59
60
---
61
62
### Step 1 - Ensure main is up to date
63
64
```bash
65
git checkout main
66
git pull origin main
67
```
68
69
Stay on `main` for now. The release branch is created in Step 5, after the version
70
is confirmed.
71
72
---
73
74
### Step 2 - Grab the latest version tag
75
76
> **Why not `gh release list`?** GitHub Releases are an optional layer on top of Git
77
> tags. Many repos tag releases with `git tag` without ever creating a GitHub Release,
78
> so `gh release list` can return empty even when version tags exist. Reading tags
79
> directly from git is the reliable source of truth.
80
81
```bash
82
# Fetch all tags from remote to ensure local view is current
83
git fetch --tags
84
85
# Find the latest version tag, sorted semantically
86
# --sort=-version:refname handles 1.10.0 > 1.9.0 correctly (unlike alphabetical)
87
PREV_TAG=$(git tag --sort=-version:refname | grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+' | head -1)
88
echo "Latest tag: $PREV_TAG"
89
```
90
91
```PowerShell
92
# Fetch all tags from remote to ensure local view is current
93
git fetch --tags
94
95
# Find the latest version tag, sorted semantically
96
# --sort=-version:refname handles 1.10.0 > 1.9.0 correctly (unlike alphabetical)
97
$prevTag = git tag --sort='-version:refname' | `
98
Select-String '^[vV]?\d+\.\d+\.\d+' | `
99
Select-Object -First 1 -ExpandProperty Line
100
101
if ($prevTag) {
102
$prevSha = git rev-list -n 1 $prevTag
103
} else {
104
$prevSha = git rev-list --max-parents=0 HEAD
105
}
106
107
Write-Output "Latest tag: $prevTag"
108
```
109
110
Then verify the tag exists on the remote (not just locally):
111
112
```bash
113
git ls-remote --tags origin | grep "refs/tags/$PREV_TAG$"
114
```
115
116
If the remote check returns nothing, warn the user that the tag appears to be local-only
117
and hasn't been pushed - they may want to push it before continuing.
118
119
- `PREV_TAG` is the tag name exactly as found (e.g. `v1.4.2`). Strip any leading `v`
120
when doing arithmetic; preserve it when naming things.
121
- If **no tags exist at all**, treat `PREV_TAG` as `(none)`, set `PREV_SHA` to the
122
first commit, and default the new version to `1.0.0` (skip Step 4 versioning logic;
123
go straight to Step 5).
124
- If the tag does not point to a real commit (orphaned tag), fall back to
125
`git rev-list --max-parents=0 HEAD` and warn the user.
126
127
```bash
128
PREV_SHA=$(git rev-list -n 1 "$PREV_TAG" 2>/dev/null || git rev-list --max-parents=0 HEAD)
129
```
130
131
---
132
133
### Step 3 - Analyse what changed since the last release
134
135
This step uses **two complementary signals**. The code diff is the primary source of
136
truth; commit messages provide supporting context about intent.
137
138
#### 3a - Code diff (primary signal)
139
140
```bash
141
# Focused diff on the public source path, excluding noise
142
git diff "$PREV_SHA"..HEAD -- "$PUBLIC_PATH" \
143
':(exclude)tests/' ':(exclude)test/' ':(exclude)spec/' \
144
':(exclude)__tests__/' ':(exclude)docs/' \
145
':(exclude)*.lock' ':(exclude)*-lock.json' ':(exclude)*.sum'
146
```
147
148
```PowerShell
149
# Focused diff on the public source path, excluding noise
150
git diff "$($prevSha)..HEAD" -- $publicPath `
151
':(exclude)tests/' ':(exclude)test/' ':(exclude)spec/' `
152
':(exclude)__tests__/' ':(exclude)docs/' `
153
':(exclude)*.lock' ':(exclude)*-lock.json' ':(exclude)*.sum'
154
```
155
156
Read the full diff output. For each changed file, identify:
157
158
1. **Removed symbols** - functions, classes, methods, constants, exported names that
159
existed before and are now gone. ? Strong signal for MAJOR.
160
2. **Changed signatures** - functions that exist in both versions but with different
161
parameters, return types, or thrown errors. ? Strong signal for MAJOR.
162
3. **New exported symbols** - public functions, classes, constants that didn't exist
163
before. ? Signal for MINOR.
164
4. **Internal-only changes** - modifications that don't touch any public interface
165
(private helpers, unexported functions, algorithm internals). ? PATCH.
166
5. **Bug fixes** - corrections to logic that was provably wrong (e.g. off-by-one,
167
null check, wrong condition), without changing the public API. ? PATCH.
168
169
If the diff is very large (thousands of lines), first run the stat summary to
170
prioritise which files to read in full:
171
172
```bash
173
git diff "$PREV_SHA"..HEAD --stat -- "$PUBLIC_PATH"
174
```
175
176
Focus your detailed reading on files with the most changes and files whose names
177
suggest they define public interfaces (e.g. `index.*`, `api.*`, `exports.*`,
178
`public.*`, `mod.*`, `__init__.*`).
179
180
#### 3b - Commit log (secondary signal)
181
182
```bash
183
git log "$PREV_SHA"..HEAD --oneline --no-merges
184
```
185
186
Use this to:
187
- Understand the **intent** behind code changes that aren't self-explanatory from
188
the diff alone (e.g. a one-line security fix labelled as such).
189
- Catch changes that may be in paths outside `PUBLIC_PATH` but are still user-visible
190
(e.g. a CLI flag change in a `cmd/` directory).
191
- Fill in context for changelog entries where the code alone doesn't tell the whole
192
story.
193
194
See `references/commit-classification.md` for mapping message patterns to change types.
195
196
#### 3c - Reconcile the two signals
197
198
When signals agree ? use that classification with confidence.
199
200
When signals conflict ? **prefer the code diff**. Examples:
201
- Commit says `fix: typo` but the diff shows a removed public method ? treat as MAJOR.
202
- Commit says `feat: new API` but the diff only touches private internals ? treat as PATCH.
203
- Commit says `chore: refactor` but the diff adds new exported symbols ? treat as MINOR.
204
205
Document any conflicts you notice - flag them to the user during the changelog review
206
in Step 6.
207
208
---
209
210
### Step 4 - Determine the next SemVer version
211
212
Apply these rules to your analysis from Step 3 (full rules in `references/semver-rules.md`):
213
214
| Condition | Bump |
215
|---|---|
216
| Any breaking change to public API (removal, signature change, behaviour change) | MAJOR |
217
| New exported symbol or feature, no breaking changes | MINOR |
218
| Bug fix, perf improvement, security fix, docs, chore only | PATCH |
219
220
When a release contains a mix, the **highest precedence wins**:
221
`MAJOR > MINOR > PATCH`.
222
223
Compute `NEXT_VERSION`:
224
- Split `PREV_TAG` into `MAJOR.MINOR.PATCH` integers.
225
- Apply the appropriate bump.
226
- Format as `vMAJOR.MINOR.PATCH`.
227
228
**Present the proposed version to the user** with a brief rationale that cites
229
specific code findings, not just commit messages. Example:
230
231
> *"I'm proposing v2.1.0. The diff shows two new exported functions (`NewClient` and
232
> `WithTimeout`) in `src/client.go`, and no existing public symbols were removed or
233
> changed. Commit messages corroborate this as feature additions."*
234
235
Ask: *"Does this version look right, or would you like to adjust it?"*
236
Wait for confirmation before proceeding.
237
238
---
239
240
### Step 5 - Create the release branch
241
242
Now that the version is confirmed, create the branch with the correct name from the start:
243
244
```bash
245
git checkout -b release/vX.Y.Z
246
git push -u origin release/vX.Y.Z
247
```
248
249
---
250
251
### Step 6 - Update CHANGELOG.md
252
253
Read the existing `CHANGELOG.md` (or create it if absent). Follow the
254
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format strictly.
255
256
**Structure to insert** at the top (just below the `# Changelog` header):
257
258
```markdown
259
## [X.Y.Z] - YYYY-MM-DD
260
261
### Added
262
- ...
263
264
### Changed
265
- ...
266
267
### Deprecated
268
- ...
269
270
### Removed
271
- ...
272
273
### Fixed
274
- ...
275
276
### Security
277
- ...
278
```
279
280
Rules:
281
- Use today's date in `YYYY-MM-DD` format.
282
- Omit sections that have no entries - don't leave empty headings.
283
- Write entries in **plain English from a user's perspective**, derived primarily
284
from what the code diff shows, supplemented by commit message context.
285
Good: *"Added `WithTimeout` option to HTTP client constructor."*
286
Bad: *"feat: add timeout cfg param"*
287
- Map findings to sections:
288
- New exported symbol ? Added
289
- Breaking removal ? Removed
290
- Breaking change to existing API ? Changed (flag it as breaking)
291
- Bug/logic fix, perf ? Fixed
292
- Security fix ? Security
293
- Internal refactor, docs, chore, test ? omit unless user-visible
294
- If a commit message revealed intent that the code diff alone wouldn't convey
295
(e.g. a security fix disguised as a one-line change), include that context in
296
the changelog entry.
297
- Also update the diff link at the bottom of the file:
298
```markdown
299
[X.Y.Z]: https://github.com/OWNER/REPO/compare/vPREV...vNEXT
300
```
301
302
**Show the user the proposed changelog section before writing it to disk.**
303
If any signal conflicts were found in Step 3c, flag them here so the user can verify.
304
Ask: *"Does this changelog look accurate? Any entries to add, remove, or reword?"*
305
Incorporate feedback, then write to disk.
306
307
---
308
309
### Step 7 - Commit and push
310
311
```bash
312
git add CHANGELOG.md
313
git commit -m "chore: release vX.Y.Z"
314
git push origin release/vX.Y.Z
315
```
316
317
Confirm the push succeeded before moving on.
318
319
---
320
321
### Step 8 - Open a Pull Request
322
323
**?? IMPORTANT:** Always use `--body-file` to pass PR body text, never `--body` with inline text.
324
Inline escape sequences like `\n` are not interpreted as newlines by PowerShell and will appear
325
as literal text in the PR. Using a file ensures proper markdown formatting.
326
327
```bash
328
gh pr create \
329
--base main \
330
--head release/vX.Y.Z \
331
--title "Release vX.Y.Z" \
332
--body "$(cat <<'EOF'
333
## Release vX.Y.Z
334
335
This PR prepares the **vX.Y.Z** release.
336
337
### What's included
338
<!-- paste the changelog section here -->
339
340
### Checklist
341
- [ ] Changelog reviewed
342
- [ ] Version bump verified
343
- [ ] CI passing
344
345
After merging, create the tag on the merge commit:
346
\`\`\`
347
git tag vX.Y.Z <merge-commit-sha>
348
git push origin vX.Y.Z
349
\`\`\`
350
EOF
351
)"
352
```
353
354
````PowerShell
355
# Create PR body using here-string (preserves actual newlines, not escape sequences)
356
$prBody = @"
357
## Release vX.Y.Z
358
359
This PR prepares the **vX.Y.Z** release.
360
361
### What's included
362
<paste changelog here>
363
364
### Checklist
365
- [ ] Changelog reviewed
366
- [ ] Version bump verified
367
- [ ] CI passing
368
369
After merging, create the tag on the merge commit:
370
```
371
git tag vX.Y.Z <merge-commit-sha>
372
git push origin vX.Y.Z
373
```
374
"@
375
376
# Write to file and use --body-file (do NOT use inline --body with escape sequences)
377
$prBody | Out-File -FilePath release_pr_body.md -Encoding utf8 -NoNewline
378
gh pr create --base main --head release/vX.Y.Z --title "Release vX.Y.Z" --body-file release_pr_body.md
379
````
380
381
Paste the changelog section into the PR body's "What's included" block (or leave placeholder for manual review).
382
383
384
---
385
386
### Step 9 - Hand off to the user
387
388
Tell the user:
389
390
> **Release PR is open! ??**
391
>
392
> New version: **vX.Y.Z**
393
>
394
> Once the PR is reviewed and merged, you'll need to **create the tag yourself** on
395
> the merge commit:
396
>
397
> ```bash
398
> git tag vX.Y.Z <merge-commit-sha>
399
> git push origin vX.Y.Z
400
> ```
401
>
402
> Then go to GitHub Releases and publish the release from that tag. You can copy the
403
> changelog section directly into the release notes.
404
405
---
406
407
## Error handling
408
409
| Situation | What to do |
410
|---|---|
411
| `gh auth status` fails | Stop; tell user to run `gh auth login` |
412
| Not inside a git repo | Stop; tell user to `cd` into their repo |
413
| Working tree is dirty | Warn; ask if they want to stash or abort |
414
| No commits since last tag | Tell user there's nothing to release |
415
| Tag exists but points to no commit | Use first commit as diff base; warn user |
416
| Latest tag exists locally but not on remote | Warn user; ask if they want to push the tag first or continue anyway |
417
| Diff is empty for `PUBLIC_PATH` but commits exist | Warn; all changes may be internal; ask if they still want to proceed |
418
| `git push` fails (e.g. protected branch rules) | Report the error verbatim; suggest they check branch protection settings |
419
420
---
421
422
## Troubleshooting in PowerShell
423
424
- If a command that works locally prints gh usage or treats a subcommand as separate token, ensure you're
425
invoking the gh.exe on PATH (Get-Command gh) and avoid passing unexpanded nested substitutions; use the PowerShell
426
patterns above.
427
- Recommend tests: gh --version; git fetch --tags; run the PowerShell snippet to set $prevTag and run git diff --name-only $prevSha..HEAD -- src/
428
429
---
430
431
## Limitations
432
433
- Requires the `gh` CLI to be installed and authenticated.
434
- Requires git tags to determine current version.
435
436
---
437
438
## Reference files
439
440
- `references/semver-rules.md` - Extended SemVer decision rules and edge cases
441
- `references/commit-classification.md` - Heuristics for classifying commit messages into change types
442

© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 6,373 prompts

More by @OpenSourceBuffGuy

See all
Website Clone Architect prompt image

Website Clone Architect

Reverse-engineers a website section by section, writes component specs, and hands them to parallel builder agents in git worktrees to rebuild it.

agent-skill, orchestrator, parallel-agents, multi-agent, plan-then-execute, web-development, frontend, codebase-analysis, scaffolding, css, html, nextjs, typescript, git, mcp, claude-code, for-developers, for-designers, long-form, advanced, technical-spec, task-decomposition, structured-output, design-systems, ui-ux, tool-use, checklist, report, vibe-coding

Italian Terrace Cafe Candid Portrait prompt image

Italian Terrace Cafe Candid Portrait

Generates a photorealistic candid shot of a woman in a white corset dress laughing at a sunny hotel terrace cafe, written as detailed JSON.

image-prompt, json-prompt, structured-output, photorealistic, portrait, woman, candid, fashion, cottagecore, natural-light, golden-hour, bokeh, summer, travel, cityscape, mountains, medium-shot, vibrant-colors, for-photographers, nano-banana, fashion-shoot, luxury

Night Street Photo With Leashed Cat prompt image

Night Street Photo With Leashed Cat

Generates a flash-lit night street photo of a blonde woman in a retro track jacket walking a hissing tabby cat on a leash.

image-prompt, json-prompt, nano-banana, structured-output, portrait, woman, animals, pet-portrait, night-scene, street-photography, candid, editorial, fashion, dramatic-lighting, photorealistic, vertical-format, medium-shot, graffiti, for-photographers, for-content-creators

1 view

Reviews

Loading reviews…

Discussion

Loading comments…