Skip to content

Commit 2ee7944

Browse files
committed
fix: use conventional release pr titles
1 parent 8b0b0a1 commit 2ee7944

8 files changed

Lines changed: 33 additions & 40 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ jobs:
6969
if: |
7070
(github.event_name == 'push' &&
7171
github.ref == 'refs/heads/main' &&
72-
!startsWith(github.event.head_commit.message, 'release:') &&
73-
!startsWith(github.event.head_commit.message, 'ci(release):') &&
72+
!startsWith(github.event.head_commit.message, 'build: release ') &&
7473
!startsWith(github.event.head_commit.message, 'Merge pull request') &&
7574
github.event.head_commit.author.name != 'github-actions[bot]') ||
7675
(github.event_name == 'workflow_dispatch' &&
@@ -156,8 +155,7 @@ jobs:
156155
(
157156
github.event_name == 'pull_request' &&
158157
(
159-
startsWith(github.event.pull_request.title, 'release: Release ') ||
160-
startsWith(github.event.pull_request.title, 'ci(release): Release ')
158+
startsWith(github.event.pull_request.title, 'build: release ')
161159
)
162160
) ||
163161
(
@@ -206,8 +204,7 @@ jobs:
206204
github.event_name == 'push' &&
207205
github.ref == 'refs/heads/main' &&
208206
(
209-
startsWith(github.event.head_commit.message, 'release:') ||
210-
startsWith(github.event.head_commit.message, 'ci(release):')
207+
startsWith(github.event.head_commit.message, 'build: release ')
211208
)
212209
runs-on: ubuntu-latest
213210
timeout-minutes: 120
@@ -254,7 +251,7 @@ jobs:
254251
else
255252
echo "Could not get version from git-cliff. Got: $VERSION"
256253
echo "Fallback: Extract from commit message"
257-
VERSION=$(git log -1 --pretty=format:"%s" | sed -E 's/.*Release v([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
254+
VERSION=$(git log -1 --pretty=format:"%s" | sed -E 's/.*release v([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
258255
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
259256
git config user.name "github-actions[bot]"
260257
git config user.email "github-actions[bot]@users.noreply.github.com"

‎internal/orchestrator/pr_release.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ func (o *PRReleaseOrchestrator) commitChanges(ctx context.Context, version strin
359359
}
360360
}
361361
// Commit if there are changes
362-
message := fmt.Sprintf("release: prepare release %s", version)
362+
message := fmt.Sprintf("build: prepare release %s", version)
363363
return o.gitRepo.Commit(ctx, message)
364364
}
365365

@@ -470,7 +470,7 @@ func (o *PRReleaseOrchestrator) createPullRequest(
470470
}
471471

472472
func releasePullRequestTitle(version string) string {
473-
return fmt.Sprintf("release: release %s", version)
473+
return fmt.Sprintf("build: release %s", version)
474474
}
475475

476476
// executeWithSaga runs the workflow with saga-based rollback support

‎internal/orchestrator/pr_release_test.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,9 @@ func TestPRReleaseOrchestrator_Execute(t *testing.T) {
352352
gitRepo.On("AddFiles", mock.Anything, "package.json").Return(nil).Once()
353353
gitRepo.On("AddFiles", mock.Anything, "package-lock.json").Return(nil).Once()
354354
// tools/* updates removed
355-
gitRepo.On("Commit", mock.Anything, "release: prepare release v1.1.0").Return(nil).Once()
355+
gitRepo.On("Commit", mock.Anything, "build: prepare release v1.1.0").Return(nil).Once()
356356
gitRepo.On("PushBranch", mock.Anything, branchName).Return(nil).Once()
357-
githubRepo.On("CreateOrUpdatePR", mock.Anything, branchName, "main", "release: release v1.1.0",
357+
githubRepo.On("CreateOrUpdatePR", mock.Anything, branchName, "main", "build: release v1.1.0",
358358
mock.MatchedBy(func(body string) bool {
359359
return strings.Contains(body, "Release v1.1.0") && strings.Contains(body, "### Features")
360360
}),
@@ -433,7 +433,7 @@ func TestPRReleaseOrchestrator_Execute(t *testing.T) {
433433
mock.Anything,
434434
branchName,
435435
"main",
436-
"release: release v1.1.0",
436+
"build: release v1.1.0",
437437
mock.MatchedBy(func(body string) bool {
438438
return strings.Contains(body, "Release v1.1.0") && strings.Contains(body, "### Fixes")
439439
}),
@@ -1344,7 +1344,7 @@ func TestPRReleaseOrchestrator_commitChanges(t *testing.T) {
13441344
gitRepo.On("AddFiles", ctx, "package.json").Return(nil).Once()
13451345
gitRepo.On("AddFiles", ctx, "package-lock.json").Return(nil).Once()
13461346
// no tools files added
1347-
gitRepo.On("Commit", ctx, "release: prepare release v1.2.0").Return(nil).Once()
1347+
gitRepo.On("Commit", ctx, "build: prepare release v1.2.0").Return(nil).Once()
13481348

13491349
orch := NewPRReleaseOrchestrator(gitRepo, githubRepo, fsRepo, cliffSvc, npmSvc)
13501350

‎skills/releasepr/SKILL.md‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,8 @@ Conventional-commit prefixes drive the version bump — wrong prefixes mean wron
101101
versions or "no changes":
102102

103103
- `fix:` → patch · `feat:` → minor · `feat!:` / `BREAKING CHANGE:` → major.
104-
- A commit subject starting with `release:` or `ci(release):` merged to the
105-
default branch is what triggers the **production release** — do not hand-write
106-
such commits.
104+
- A commit subject starting with `build: release ` merged to the default branch
105+
triggers the **production release** — reserve it for generated release PRs.
107106
- Bot commits and `Merge pull request` commits are skipped by the release-PR job.
108107

109108
**STOP. Read `references/release-notes.md` and `references/release-workflow.md`

‎skills/releasepr/assets/release.yml.template‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ jobs:
4646
if: |
4747
(github.event_name == 'push' &&
4848
github.ref == 'refs/heads/main' &&
49-
!startsWith(github.event.head_commit.message, 'release:') &&
50-
!startsWith(github.event.head_commit.message, 'ci(release):') &&
49+
!startsWith(github.event.head_commit.message, 'build: release ') &&
5150
!startsWith(github.event.head_commit.message, 'Merge pull request') &&
5251
github.event.head_commit.author.name != 'github-actions[bot]') ||
5352
(github.event_name == 'workflow_dispatch' &&
@@ -77,13 +76,12 @@ jobs:
7776
INITIAL_VERSION: ${{ env.INITIAL_VERSION }}
7877
run: go run "${{ env.PR_RELEASE_MODULE }}" pr-release --force --enable-rollback --ci-output
7978

80-
# Validate the release PR (title starts with "release: release ").
79+
# Validate the release PR (title starts with "build: release ").
8180
dry-run:
8281
name: Dry-Run Release Check
8382
if: |
8483
(github.event_name == 'pull_request' &&
85-
(startsWith(github.event.pull_request.title, 'release: release ') ||
86-
startsWith(github.event.pull_request.title, 'ci(release): release '))) ||
84+
startsWith(github.event.pull_request.title, 'build: release ')) ||
8785
(github.event_name == 'workflow_dispatch' && inputs.mode == 'dry-run')
8886
runs-on: ubuntu-latest
8987
steps:
@@ -110,7 +108,7 @@ jobs:
110108
run: go run "${{ env.PR_RELEASE_MODULE }}" dry-run --ci-output
111109

112110
# Production release: runs when the release PR merges (commit subject
113-
# starts with "release:" / "ci(release):"). pr-release does NOT tag or
111+
# starts with "build: release "). pr-release does NOT tag or
114112
# publish — wire your own tag + publisher here (e.g. git-cliff
115113
# --bumped-version to derive the tag, then GoReleaser / npm publish using
116114
# RELEASE_BODY.md as the GitHub Release body).
@@ -120,8 +118,7 @@ jobs:
120118
# if: |
121119
# github.event_name == 'push' &&
122120
# github.ref == 'refs/heads/main' &&
123-
# (startsWith(github.event.head_commit.message, 'release:') ||
124-
# startsWith(github.event.head_commit.message, 'ci(release):'))
121+
# startsWith(github.event.head_commit.message, 'build: release ')
125122
# runs-on: ubuntu-latest
126123
# steps:
127124
# - uses: actions/checkout@v4

‎skills/releasepr/references/release-notes.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ using `git-cliff` (config: `cliff.toml` in the repo). Use Conventional Commits:
1515
If no commit since the last tag warrants a bump, no release PR is produced.
1616
Force a release anyway with `pr-release pr-release --force`.
1717

18-
Never hand-write a commit whose subject starts with `release:` or
19-
`ci(release):` on the default branch — that prefix triggers the production
20-
release job (see `release-workflow.md`).
18+
Reserve commits whose subject starts with `build: release ` on the default
19+
branch for generated release PRs — that prefix triggers the production release
20+
job (see `release-workflow.md`).
2121

2222
## Custom release notes with `add-note`
2323

‎skills/releasepr/references/release-workflow.md‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
runs `pr-release dry-run` to validate the release end-to-end without
2323
publishing.
2424
3. **Production release** — when the release PR merges, the merge commit (whose
25-
subject starts with `release:` or `ci(release):`) triggers tagging and a
25+
subject starts with `build: release `) triggers tagging and a
2626
GoReleaser publish.
2727

2828
## What triggers the release-PR job
2929

3030
On push to the default branch, the job runs **unless** the head commit subject
31-
starts with `release:`, `ci(release):`, or `Merge pull request`, or the commit
31+
starts with `build: release ` or `Merge pull request`, or the commit
3232
author is `github-actions[bot]`. It also runs on manual dispatch with mode
3333
`release-pr`. This is why ordinary `feat:` / `fix:` commits produce a release PR
3434
but the release commit itself does not loop.
@@ -46,7 +46,7 @@ dispatch input).
4646
## What triggers the dry-run job
4747

4848
The dry-run job runs when a pull request whose title starts with
49-
`release: release ` or `ci(release): release ` is opened/synchronized/reopened
49+
`build: release ` is opened/synchronized/reopened
5050
against the default branch, or on manual dispatch with mode `dry-run` (passing
5151
`head_ref` and `pr_number`).
5252

@@ -59,8 +59,8 @@ just from running `pr-release pr-release`.
5959

6060
## What triggers the production release
6161

62-
A push to the default branch whose head commit subject starts with `release:`
63-
or `ci(release):` — i.e. the release PR being merged. The consumer's release
62+
A push to the default branch whose head commit subject starts with `build: release `
63+
— i.e. the release PR being merged. The consumer's release
6464
job (not pr-release) then:
6565

6666
1. Derives the version with `git cliff --bumped-version` (fallback: parse it
@@ -71,8 +71,8 @@ job (not pr-release) then:
7171
`--release-header-tmpl=.goreleaser.release-header.md.tmpl`,
7272
`--release-footer-tmpl=.goreleaser.release-footer.md.tmpl`.
7373

74-
Do not hand-author `release:` commits on the default branch — that is the
75-
trigger that publishes a production release.
74+
Reserve `build: release ` commits on the default branch for generated release
75+
PRs — that prefix publishes a production release.
7676

7777
## Explicit beta, stable, and legacy releases
7878

@@ -112,7 +112,7 @@ these values with `git describe` in the consuming workflow.
112112
## Branch and PR naming
113113

114114
- Release branch: `release/vMAJOR.MINOR.PATCH`.
115-
- Release PR title: `release: release vX.Y.Z` (or `ci(release): release vX.Y.Z`).
115+
- Release PR title: `build: release vX.Y.Z`.
116116
- These exact prefixes are matched by the CI `if:` conditions; renaming them
117117
breaks the dry-run and production-release triggers.
118118

@@ -131,8 +131,8 @@ these values with `git describe` in the consuming workflow.
131131
Check in this order:
132132
1. Were the commits conventional (`feat:`/`fix:`/etc.)? Non-conventional
133133
commits yield no version bump → no release PR. (`release-notes.md`)
134-
2. Was the push commit one of the skipped kinds (bot / `release:` /
135-
`ci(release):` / `Merge pull request`)? Then the release-PR job did not run
134+
2. Was the push commit one of the skipped kinds (bot / `build: release ` /
135+
`Merge pull request`)? Then the release-PR job did not run
136136
by design.
137137
3. Did owner/repo and token resolve? (`configuration.md`,
138138
`troubleshooting.md`)

‎skills/releasepr/references/troubleshooting.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Match the exact error or symptom to a row before proposing a fix.
1515
| `release_artifacts[i].add must include at least one path or glob` / `path must be repository-relative` / `path cannot contain traversal` | Missing/invalid `add` entry. | Provide ≥ 1 repo-relative path/glob, no absolute paths, no `..`. |
1616
| `release_artifacts[i].timeout_seconds must be between 1 and 3600` | Out-of-range timeout. | Use 1–3600, or omit (`0` = unset). |
1717
| `config validation failed: invalid log_level` / `invalid log_format` | Value outside the allowed set. | `log_level` ∈ debug/info/warn/error; `log_format` ∈ json/console. |
18-
| Dry-run CI job never runs on the release PR | PR title prefix not matched. | Keep the title `release: release vX.Y.Z` or `ci(release): release vX.Y.Z`; do not rename the release branch pattern. See `release-workflow.md`. |
19-
| Production release never fires after merge | Merge commit subject not `release:`/`ci(release):`, or pushed to a non-default branch. | Merge the release PR so the release commit lands on the default branch with the expected subject prefix. |
20-
| Release-PR job did not run on a normal push | Head commit was a skipped kind (bot, `release:`, `ci(release):`, `Merge pull request`). | Expected by design. Push a regular conventional commit, or dispatch the workflow with mode `release-pr`. |
18+
| Dry-run CI job never runs on the release PR | PR title prefix not matched. | Keep the title `build: release vX.Y.Z`; do not rename the release branch pattern. See `release-workflow.md`. |
19+
| Production release never fires after merge | Merge commit subject does not start with `build: release `, or it was pushed to a non-default branch. | Merge the generated release PR so its title becomes the default-branch commit subject. |
20+
| Release-PR job did not run on a normal push | Head commit was a skipped kind (bot, `build: release `, `Merge pull request`). | Expected by design. Push a regular conventional commit, or dispatch the workflow with mode `release-pr`. |
2121
| Follow-up workflows not dispatched from the release-PR job | Default `GITHUB_TOKEN` cannot trigger other workflows. | Use a dedicated `RELEASE_TOKEN` PAT/app token for that job. |
2222
| Wrong / unexpectedly low version, or always the initial version | Shallow checkout — no history/tags for `git-cliff`. | `actions/checkout@v4` with `fetch-depth: 0` and `fetch-tags: true`. See `setup.md`. |
2323
| First-ever release picks `v0.0.x` off `v0.0.0` instead of intended baseline | Repo has no tags and `INITIAL_VERSION` is unset. | Set `INITIAL_VERSION` (e.g. `v0.0.1`) in the workflow env. See `configuration.md`. |

0 commit comments

Comments
 (0)