Skip to content

Commit 39605f2

Browse files
docs(agents,ci): finish "tag-not-HEAD" sweep and fix changelog-exists gate
- tags.yaml: the check_changelog step now looks at origin/main rather than the working tree. After Round 2 we check out the release tag, which never has the changelog file (the PR opened by this job merges to main after the tag is cut), so the previous `[ -f ]` test always returned false and the gate was effectively dead on reruns. - changelog.md: Step 6's `RELEASE_END=$(git log -1 --format=%ai HEAD)` (lines 179, 222) was missed in the previous "never HEAD" sweep — now uses v<new_version>, matching Step 5. - changelog.md: Step 2 ("on main branch") was incompatible with the CI flow which now runs detached at the release tag. Relaxed it to list both configurations (interactive on main; CI detached at v<version>), while the "Scope and boundaries" section continues to forbid the agent from switching branches. Assisted-By: Claude <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent ce63bfc commit 39605f2

2 files changed

Lines changed: 25 additions & 10 deletions

File tree

‎.github/workflows/tags.yaml‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,24 @@ jobs:
300300
fetch-tags: true
301301
token: ${{ steps.app-token.outputs.token }}
302302

303+
# Check whether the changelog already exists on origin/main.
304+
# The previous step checked out the tag commit, which never has the
305+
# changelog (the changelog PR merges to main AFTER the tag is cut).
306+
# Looking at origin/main is what the gate is supposed to do — skip
307+
# generation on workflow reruns when the changelog has already merged.
303308
- name: Check if changelog already exists
304309
id: check_changelog
310+
env:
311+
VERSION: ${{ steps.tag.outputs.version }}
305312
run: |
306-
CHANGELOG_FILE="docs/changelogs/v${{ steps.tag.outputs.version }}.md"
307-
if [ -f "$CHANGELOG_FILE" ]; then
313+
CHANGELOG_FILE="docs/changelogs/v${VERSION}.md"
314+
git fetch origin main --depth=1
315+
if git cat-file -e "origin/main:${CHANGELOG_FILE}" 2>/dev/null; then
308316
echo "exists=true" >> $GITHUB_OUTPUT
309-
echo "Changelog file $CHANGELOG_FILE already exists"
317+
echo "Changelog file $CHANGELOG_FILE already exists on origin/main"
310318
else
311319
echo "exists=false" >> $GITHUB_OUTPUT
312-
echo "Changelog file $CHANGELOG_FILE does not exist"
320+
echo "Changelog file $CHANGELOG_FILE does not exist on origin/main"
313321
fi
314322
315323
- name: Setup Node.js

‎docs/agents/changelog.md‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,18 @@ This is necessary to get up-to-date information about tags and commits from the
5454

5555
### 2. Checking current branch
5656

57-
Make sure we are on the `main` branch:
57+
Verify the working tree is at a sensible starting point. Two configurations are valid:
5858

59-
```bash
60-
git branch --show-current
61-
```
59+
- **Interactive use:** the working tree is on the `main` branch.
60+
```bash
61+
git branch --show-current # should print "main"
62+
```
63+
- **CI use:** HEAD is detached at the release tag being generated (this is how `.github/workflows/tags.yaml` runs).
64+
```bash
65+
git describe --exact-match HEAD # should print e.g. "v1.3.1"
66+
```
67+
68+
If neither holds, stop — the caller invoked you from the wrong place. Do **not** switch branches yourself; the "Scope and boundaries" section forbids it.
6269

6370
### 3. Determining release type and previous version
6471

@@ -176,7 +183,7 @@ Cozystack release may include changes from related repositories. Check and inclu
176183
# Get dates for the release period
177184
cd /path/to/cozystack
178185
RELEASE_START=$(git log -1 --format=%ai v<previous_version>)
179-
RELEASE_END=$(git log -1 --format=%ai HEAD)
186+
RELEASE_END=$(git log -1 --format=%ai v<new_version>)
180187
```
181188

182189
2. **Check for commits in website repository (always required):**
@@ -219,7 +226,7 @@ Cozystack release may include changes from related repositories. Check and inclu
219226
```bash
220227
# Get release period dates
221228
RELEASE_START=$(git log -1 --format=%ai v<previous_version>)
222-
RELEASE_END=$(git log -1 --format=%ai HEAD)
229+
RELEASE_END=$(git log -1 --format=%ai v<new_version>)
223230

224231
# Run the script to check all optional repositories
225232
./docs/changelogs/hack/check-optional-repos.sh "$RELEASE_START" "$RELEASE_END"

0 commit comments

Comments
 (0)