@@ -87,12 +87,14 @@ runs:
8787 core.setOutput('stable_version', '0.0.0');
8888 }
8989
90- - name : Gather change context
90+ - name : Write version prompt
9191 id : context
9292 shell : bash
9393 env :
9494 BASE_SHA : ${{ steps.last-release.outputs.stable_sha }}
9595 HEAD_SHA : ${{ github.sha }}
96+ STABLE_VERSION : ${{ steps.last-release.outputs.stable_version }}
97+ PRERELEASE : ${{ inputs.prerelease }}
9698 run : |
9799 set -euo pipefail
98100 # No prior stable release -> diff against the empty tree so the entire
@@ -107,9 +109,46 @@ runs:
107109 STAT=$(clip "$(git diff --stat "$DIFF_BASE" "$HEAD_SHA")" 40000)
108110 LOG=$(clip "$(git log --no-merges --format='- %s%n%b' $LOG_RANGE)" 100000)
109111 DIFF=$(clip "$(git diff "$DIFF_BASE" "$HEAD_SHA")" 400000)
110- MARKER=$(openssl rand -hex 16)
112+ PROMPT_FILE="${RUNNER_TEMP}/determine-publish-version-prompt.md"
111113 {
112- echo "context<<${MARKER}"
114+ echo "Determine the next semantic version after ${STABLE_VERSION}."
115+ echo "Current version: ${STABLE_VERSION}"
116+ echo "Prerelease: ${PRERELEASE}"
117+ echo
118+ cat <<'PROMPT'
119+ Base your decision on the ACTUAL CODE CHANGES below — the commit
120+ messages, the list of changed files, and the diff are all provided.
121+ Commit messages are a hint, not the source of truth: most authors do
122+ not annotate breaking changes, so the diff is authoritative. If the diff
123+ was truncated you may run `git diff` yourself (read-only) for any file.
124+
125+ How to choose the bump (apply in order):
126+ 1. MAJOR — if a commit message carries an explicit `BREAKING CHANGE:`
127+ footer or a `type!:` marker, that is authoritative: bump major.
128+ ALSO bump major if the DIFF itself is backward-incompatible even when
129+ no commit said so — e.g. a public endpoint/route/exported symbol is
130+ removed or renamed, a request/response schema or required field
131+ changes shape, default behavior changes in a way that breaks existing
132+ callers, or a config/runtime contract changes. You are explicitly
133+ allowed to bump the major from the diff alone.
134+ 2. MINOR — backward-COMPATIBLE new functionality: a new endpoint, flag,
135+ exported symbol, or capability is ADDED without breaking existing
136+ ones (corresponds to `feat:`).
137+ 3. PATCH — bug fixes, performance, internal refactors, docs, chores, or
138+ anything else that neither adds public surface nor breaks it.
139+
140+ Be conservative about MAJOR to avoid false positives: purely additive
141+ changes are MINOR, not MAJOR. Only call it breaking if existing public
142+ behavior is actually removed or changed incompatibly. When genuinely
143+ unclear between two levels, pick the lower one (default to patch).
144+ PROMPT
145+ echo
146+ echo "A major bump of ${STABLE_VERSION} increments the first number and"
147+ echo "zeroes the rest (e.g. 0.1.5 -> 1.0.0); minor increments the"
148+ echo "second (0.1.5 -> 0.2.0); patch the third (0.1.5 -> 0.1.6)."
149+ echo "For prereleases use the same logic — the -rc suffix is added automatically."
150+ echo
151+ echo "=== CHANGES SINCE ${STABLE_VERSION} ==="
113152 echo "## Commit messages"
114153 echo "$LOG"
115154 echo
@@ -123,8 +162,11 @@ runs:
123162 echo '```diff'
124163 echo "$DIFF"
125164 echo '```'
126- echo "${MARKER}"
127- } >> "$GITHUB_OUTPUT"
165+ echo "=== END CHANGES ==="
166+ echo
167+ echo "Respond with ONLY X.Y.Z"
168+ } > "$PROMPT_FILE"
169+ echo "prompt-file=${PROMPT_FILE}" >> "$GITHUB_OUTPUT"
128170
129171 - name : AI Determine Version
130172 id : ai-version
@@ -133,47 +175,7 @@ runs:
133175 openai-api-key : ${{ inputs.openai-api-key }}
134176 safety-strategy : read-only
135177 effort : high
136- prompt : |
137- Determine the next semantic version after ${{ steps.last-release.outputs.stable_version }}.
138- Current version: ${{ steps.last-release.outputs.stable_version }}
139- Prerelease: ${{ inputs.prerelease }}
140-
141- Base your decision on the ACTUAL CODE CHANGES below — the commit
142- messages, the list of changed files, and the diff are all provided.
143- Commit messages are a hint, not the source of truth: most authors do
144- not annotate breaking changes, so the diff is authoritative. If the diff
145- was truncated you may run `git diff` yourself (read-only) for any file.
146-
147- How to choose the bump (apply in order):
148- 1. MAJOR — if a commit message carries an explicit `BREAKING CHANGE:`
149- footer or a `type!:` marker, that is authoritative: bump major.
150- ALSO bump major if the DIFF itself is backward-incompatible even when
151- no commit said so — e.g. a public endpoint/route/exported symbol is
152- removed or renamed, a request/response schema or required field
153- changes shape, default behavior changes in a way that breaks existing
154- callers, or a config/runtime contract changes. You are explicitly
155- allowed to bump the major from the diff alone.
156- 2. MINOR — backward-COMPATIBLE new functionality: a new endpoint, flag,
157- exported symbol, or capability is ADDED without breaking existing
158- ones (corresponds to `feat:`).
159- 3. PATCH — bug fixes, performance, internal refactors, docs, chores, or
160- anything else that neither adds public surface nor breaks it.
161-
162- Be conservative about MAJOR to avoid false positives: purely additive
163- changes are MINOR, not MAJOR. Only call it breaking if existing public
164- behavior is actually removed or changed incompatibly. When genuinely
165- unclear between two levels, pick the lower one (default to patch).
166-
167- A major bump of ${{ steps.last-release.outputs.stable_version }} increments
168- the first number and zeroes the rest (e.g. 0.1.5 -> 1.0.0); minor
169- increments the second (0.1.5 -> 0.2.0); patch the third (0.1.5 -> 0.1.6).
170- For prereleases use the same logic — the -rc suffix is added automatically.
171-
172- === CHANGES SINCE ${{ steps.last-release.outputs.stable_version }} ===
173- ${{ steps.context.outputs.context }}
174- === END CHANGES ===
175-
176- Respond with ONLY X.Y.Z
178+ prompt-file : ${{ steps.context.outputs.prompt-file }}
177179
178180 - name : Parse Version
179181 id : version
0 commit comments