Skip to content

Commit 144d2c9

Browse files
committed
chore: updates to release note gen in release workflow
1 parent 413ef00 commit 144d2c9

3 files changed

Lines changed: 85 additions & 57 deletions

File tree

.github/workflows/release.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ on:
1616
tags:
1717
- 'v*'
1818

19+
permissions:
20+
contents: write # Required to create releases and upload assets
21+
1922
env:
2023
VERSION: ${{ github.ref_name }}
2124

@@ -251,20 +254,26 @@ jobs:
251254
- Previous version: $PREV_TAG
252255
- Is minor version bump (breaking changes expected): $IS_MINOR
253256
254-
Generate the release notes now. Output ONLY the markdown release notes, no preamble or explanation."
257+
Write the release notes to a file called release_notes.md in the current directory.
258+
The file should contain ONLY the markdown release notes - no preamble, no explanation, no code fences.
259+
Start directly with the summary sentence."
255260
256261
echo "Prompt length: ${#PROMPT} characters"
257262
echo "Running Claude Code..."
258263
259-
# Run Claude Code - capture both stdout and stderr
260-
if claude -p "$PROMPT" > release_notes.md 2>&1; then
261-
echo "Success! Generated release notes:"
262-
cat release_notes.md
264+
# Run Claude Code - have it write directly to file
265+
# --allowedTools "Write" pre-approves file writes (no interactive prompt in CI)
266+
if claude -p "$PROMPT" --allowedTools "Write" 2>&1; then
267+
if [ -f release_notes.md ]; then
268+
echo "Success! Generated release notes:"
269+
cat release_notes.md
270+
else
271+
echo "ERROR: release_notes.md was not created"
272+
exit 1
273+
fi
263274
else
264275
EXIT_CODE=$?
265276
echo "Claude Code failed with exit code $EXIT_CODE"
266-
echo "Output (if any):"
267-
cat release_notes.md || true
268277
exit $EXIT_CODE
269278
fi
270279

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ init: ## Create .settings.json from .settings.json.example
7171
release: ## Create and push a release tag (triggers GitHub Actions release workflow)
7272
@./scripts/tag-release.sh
7373

74+
release-force: ## Create and push a release tag, skipping signoff check
75+
@./scripts/tag-release.sh --no-signoff
76+
7477
release-local: ## Emergency fallback: run full release locally (use only if GH Actions unavailable)
7578
@./scripts/release.sh
7679

scripts/tag-release.sh

Lines changed: 66 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ GREEN='\033[0;32m'
2323
CYAN='\033[0;36m'
2424
RESET='\033[0m'
2525

26+
# Parse arguments
27+
SKIP_SIGNOFF=false
28+
while [[ "$#" -gt 0 ]]; do
29+
case $1 in
30+
--no-signoff) SKIP_SIGNOFF=true ;;
31+
*) echo "Unknown parameter: $1"; exit 1 ;;
32+
esac
33+
shift
34+
done
35+
2636
# Set the working directory to the project root
2737
cd "$(dirname "$0")/.." || exit
2838

@@ -73,62 +83,68 @@ fi
7383

7484
# Verify the commit has been signed off (via GitHub Actions check run)
7585
# Polls until signoff passes, fails, or times out
76-
echo ""
77-
echo "Verifying commit signoff..."
7886
COMMIT_SHA=$(git rev-parse origin/main)
7987
COMMIT_SHORT=$(git rev-parse --short origin/main)
8088

81-
MAX_ATTEMPTS=60 # 10 minutes max (60 * 10 seconds)
82-
ATTEMPT=1
83-
84-
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
85-
# GitHub Actions creates "check runs", not "commit statuses" - use the check-runs API
86-
CHECK_RUNS=$(gh api \
87-
-H "Accept: application/vnd.github+json" \
88-
-H "X-GitHub-Api-Version: 2022-11-28" \
89-
"/repos/sequinstream/sequin/commits/$COMMIT_SHA/check-runs" 2>/dev/null || echo '{"check_runs":[]}')
90-
91-
SIGNOFF_SUCCESS=$(echo "$CHECK_RUNS" | jq '[.check_runs[] | select(.name=="signoff" and .conclusion=="success")] | length')
92-
SIGNOFF_FAILED=$(echo "$CHECK_RUNS" | jq '[.check_runs[] | select(.name=="signoff" and .conclusion=="failure")] | length')
93-
SIGNOFF_PENDING=$(echo "$CHECK_RUNS" | jq '[.check_runs[] | select(.name=="signoff" and .status=="in_progress")] | length')
94-
SIGNOFF_QUEUED=$(echo "$CHECK_RUNS" | jq '[.check_runs[] | select(.name=="signoff" and .status=="queued")] | length')
95-
96-
if [ "$SIGNOFF_SUCCESS" -gt 0 ]; then
97-
echo -e "${GREEN}✓ Commit $COMMIT_SHORT has been signed off${RESET}"
98-
break
99-
elif [ "$SIGNOFF_FAILED" -gt 0 ]; then
100-
echo -e "${RED}✗ Signoff failed for commit $COMMIT_SHORT${RESET}"
101-
echo " Check the workflow run: https://github.com/sequinstream/sequin/commit/$COMMIT_SHA"
102-
exit 1
103-
elif [ "$SIGNOFF_PENDING" -gt 0 ] || [ "$SIGNOFF_QUEUED" -gt 0 ]; then
104-
if [ $ATTEMPT -eq 1 ]; then
105-
echo -e "${YELLOW}⏳ Signoff is running for commit $COMMIT_SHORT, waiting...${RESET}"
106-
fi
107-
printf "."
108-
sleep 10
109-
ATTEMPT=$((ATTEMPT + 1))
110-
else
111-
# No signoff check found yet - might not have started
112-
if [ $ATTEMPT -eq 1 ]; then
113-
echo -e "${YELLOW}⏳ Waiting for signoff workflow to start...${RESET}"
89+
if [ "$SKIP_SIGNOFF" = true ]; then
90+
echo ""
91+
echo -e "${YELLOW}⚠️ Skipping signoff check (--no-signoff)${RESET}"
92+
else
93+
echo ""
94+
echo "Verifying commit signoff..."
95+
96+
MAX_ATTEMPTS=60 # 10 minutes max (60 * 10 seconds)
97+
ATTEMPT=1
98+
99+
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
100+
# GitHub Actions creates "check runs", not "commit statuses" - use the check-runs API
101+
CHECK_RUNS=$(gh api \
102+
-H "Accept: application/vnd.github+json" \
103+
-H "X-GitHub-Api-Version: 2022-11-28" \
104+
"/repos/sequinstream/sequin/commits/$COMMIT_SHA/check-runs" 2>/dev/null || echo '{"check_runs":[]}')
105+
106+
SIGNOFF_SUCCESS=$(echo "$CHECK_RUNS" | jq '[.check_runs[] | select(.name=="signoff" and .conclusion=="success")] | length')
107+
SIGNOFF_FAILED=$(echo "$CHECK_RUNS" | jq '[.check_runs[] | select(.name=="signoff" and .conclusion=="failure")] | length')
108+
SIGNOFF_PENDING=$(echo "$CHECK_RUNS" | jq '[.check_runs[] | select(.name=="signoff" and .status=="in_progress")] | length')
109+
SIGNOFF_QUEUED=$(echo "$CHECK_RUNS" | jq '[.check_runs[] | select(.name=="signoff" and .status=="queued")] | length')
110+
111+
if [ "$SIGNOFF_SUCCESS" -gt 0 ]; then
112+
echo -e "${GREEN}✓ Commit $COMMIT_SHORT has been signed off${RESET}"
113+
break
114+
elif [ "$SIGNOFF_FAILED" -gt 0 ]; then
115+
echo -e "${RED}✗ Signoff failed for commit $COMMIT_SHORT${RESET}"
116+
echo " Check the workflow run: https://github.com/sequinstream/sequin/commit/$COMMIT_SHA"
117+
exit 1
118+
elif [ "$SIGNOFF_PENDING" -gt 0 ] || [ "$SIGNOFF_QUEUED" -gt 0 ]; then
119+
if [ $ATTEMPT -eq 1 ]; then
120+
echo -e "${YELLOW}⏳ Signoff is running for commit $COMMIT_SHORT, waiting...${RESET}"
121+
fi
122+
printf "."
123+
sleep 10
124+
ATTEMPT=$((ATTEMPT + 1))
125+
else
126+
# No signoff check found yet - might not have started
127+
if [ $ATTEMPT -eq 1 ]; then
128+
echo -e "${YELLOW}⏳ Waiting for signoff workflow to start...${RESET}"
129+
fi
130+
printf "."
131+
sleep 10
132+
ATTEMPT=$((ATTEMPT + 1))
114133
fi
115-
printf "."
116-
sleep 10
117-
ATTEMPT=$((ATTEMPT + 1))
118-
fi
119-
done
134+
done
120135

121-
# Check if we exited the loop due to timeout
122-
if [ $ATTEMPT -gt $MAX_ATTEMPTS ]; then
123-
echo ""
124-
echo -e "${RED}✗ Timeout waiting for signoff (10 minutes)${RESET}"
125-
echo " Check status at: https://github.com/sequinstream/sequin/commit/$COMMIT_SHA"
126-
exit 1
127-
fi
136+
# Check if we exited the loop due to timeout
137+
if [ $ATTEMPT -gt $MAX_ATTEMPTS ]; then
138+
echo ""
139+
echo -e "${RED}✗ Timeout waiting for signoff (10 minutes)${RESET}"
140+
echo " Check status at: https://github.com/sequinstream/sequin/commit/$COMMIT_SHA"
141+
exit 1
142+
fi
128143

129-
# Add newline after dots
130-
if [ $ATTEMPT -gt 1 ]; then
131-
echo ""
144+
# Add newline after dots
145+
if [ $ATTEMPT -gt 1 ]; then
146+
echo ""
147+
fi
132148
fi
133149

134150
# Show what will happen

0 commit comments

Comments
 (0)