Skip to content

Commit 3e80dbe

Browse files
ci: fix version drift, clean up zero-diff comment, remove .post from pre-release regex
- Set versioningStrategy to 'manual' in gen.yaml (matches terraform-provider-airbyte) so Speakeasy respects --set-version instead of auto-incrementing from gen.lock - Clean up zero-diff PR comment: relative paths with +/- line counts, concise body - Remove .post from pre-release version regex (.post is a PEP 440 post-release, not a pre-release, and would be installed by default via pip) Co-Authored-By: AJ Steers <aj@airbyte.io>
1 parent f519468 commit 3e80dbe

3 files changed

Lines changed: 31 additions & 24 deletions

File tree

.github/workflows/pre-release-command.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
VERSION="${{ inputs.version }}"
101101
102102
# PEP 440 pre-release pattern: X.Y.Z(a|b|rc|dev)N
103-
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(a|b|rc|dev|\.dev|\.post)[0-9]+$'; then
103+
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(a|b|rc|dev|\.dev)[0-9]+$'; then
104104
echo "::error::Invalid version or missing pre-release suffix. Expected PEP 440 format: X.Y.Z(a|b|rc|dev)N (e.g. 1.0.0rc1). Got: $VERSION"
105105
exit 1
106106
fi

.github/workflows/test-full.yml

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -76,32 +76,50 @@ jobs:
7676
- name: Compare generated code against committed code
7777
id: diff-check
7878
run: |
79-
DIFF_OUTPUT=""
79+
DIFF_SUMMARY=""
8080
8181
echo "=== Comparing generated SDK code ==="
8282
# Compare src/ directory
8383
if [ -d "src/" ] && [ -d "/tmp/generated/src/" ]; then
84-
SRC_DIFF=$(diff -rq src/ /tmp/generated/src/ 2>&1 || true)
85-
if [ -n "$SRC_DIFF" ]; then
86-
DIFF_OUTPUT="${DIFF_OUTPUT}${SRC_DIFF}"$'\n'
84+
while IFS= read -r line; do
85+
# Extract relative path from diff output
86+
FILE=$(echo "$line" | sed 's|^Files ||; s| and /tmp/generated/.*||')
87+
ADDED=$(diff -u "$FILE" "/tmp/generated/$FILE" 2>/dev/null | tail -n +3 | grep -c '^+' || echo "0")
88+
REMOVED=$(diff -u "$FILE" "/tmp/generated/$FILE" 2>/dev/null | tail -n +3 | grep -c '^-' || echo "0")
89+
DIFF_SUMMARY="${DIFF_SUMMARY}${FILE} (+${ADDED}/-${REMOVED})"$'\n'
90+
done < <(diff -rq src/ /tmp/generated/src/ 2>&1 | grep "^Files" || true)
91+
92+
# Check for files only in one side
93+
ONLY_LINES=$(diff -rq src/ /tmp/generated/src/ 2>&1 | grep "^Only" || true)
94+
if [ -n "$ONLY_LINES" ]; then
95+
while IFS= read -r line; do
96+
DIR=$(echo "$line" | sed 's|^Only in /tmp/generated/||; s|^Only in ||; s|: |/|')
97+
if echo "$line" | grep -q "^Only in /tmp/generated/"; then
98+
DIFF_SUMMARY="${DIFF_SUMMARY}${DIR} (new file)"$'\n'
99+
else
100+
DIFF_SUMMARY="${DIFF_SUMMARY}${DIR} (deleted)"$'\n'
101+
fi
102+
done <<< "$ONLY_LINES"
87103
fi
88104
elif [ -d "/tmp/generated/src/" ]; then
89-
DIFF_OUTPUT="src/ directory missing in committed code but present in generated output"$'\n'
105+
DIFF_SUMMARY="src/ directory missing in committed code but present in generated output"$'\n'
90106
fi
91107
92108
# Compare pyproject.toml
93109
if [ -f "/tmp/generated/pyproject.toml" ]; then
94110
TOML_DIFF=$(diff -q pyproject.toml /tmp/generated/pyproject.toml 2>&1 || true)
95111
if [ -n "$TOML_DIFF" ]; then
96-
DIFF_OUTPUT="${DIFF_OUTPUT}${TOML_DIFF}"$'\n'
112+
ADDED=$(diff -u pyproject.toml /tmp/generated/pyproject.toml 2>/dev/null | tail -n +3 | grep -c '^+' || echo "0")
113+
REMOVED=$(diff -u pyproject.toml /tmp/generated/pyproject.toml 2>/dev/null | tail -n +3 | grep -c '^-' || echo "0")
114+
DIFF_SUMMARY="${DIFF_SUMMARY}pyproject.toml (+${ADDED}/-${REMOVED})"$'\n'
97115
fi
98116
fi
99117
100-
if [ -n "$DIFF_OUTPUT" ]; then
118+
if [ -n "$DIFF_SUMMARY" ]; then
101119
echo "has_diff=true" >> $GITHUB_OUTPUT
102120
echo "::warning::Generated code drift detected. The committed code does not match what the generation pipeline produces."
103-
echo "$DIFF_OUTPUT" | head -50
104-
echo "$DIFF_OUTPUT" | head -20 > /tmp/diff_summary.txt
121+
echo "$DIFF_SUMMARY"
122+
echo "$DIFF_SUMMARY" > /tmp/diff_summary.txt
105123
else
106124
echo "has_diff=false" >> $GITHUB_OUTPUT
107125
echo "Zero-diff check passed. Committed code matches generation output."
@@ -136,25 +154,14 @@ jobs:
136154
<!-- zero-diff-check -->
137155
**Generated Code Drift Detected**
138156
139-
The committed code does not match what the generation pipeline produces. This usually means a generated file was edited by hand or the generation pipeline needs to be re-run.
157+
The committed code does not match what the generation pipeline produces.
140158
141-
**To fix:** Comment `/generate` on this PR to regenerate and push updated code.
142-
143-
**To debug locally:** Download the generated artifacts and diff them against your committed code:
144-
```bash
145-
gh run download ${{ github.run_id }} --name generated_sdk_code --dir /tmp/generated_from_ci
146-
diff -rq src/ /tmp/generated_from_ci/src/
147-
```
148-
149-
<details>
150-
<summary>Diff summary</summary>
159+
**To fix:** Comment `/generate` on this PR to regenerate.
151160
152161
```
153162
${{ steps.diff-summary.outputs.content }}
154163
```
155164
156-
</details>
157-
158165
- name: Fail if drift detected
159166
if: steps.diff-check.outputs.has_diff == 'true'
160167
run: |

gen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ generation:
2020
schemas:
2121
allOfMergeStrategy: shallowMerge
2222
requestBodyFieldName: ""
23-
versioningStrategy: automatic
23+
versioningStrategy: manual
2424
persistentEdits: {}
2525
tests:
2626
generateTests: true

0 commit comments

Comments
 (0)