Skip to content

Commit 9f9e238

Browse files
committed
fix: release workflow checks out main HEAD and skips no-op versions
Two fixes: (1) checkout main instead of workflow_run.head_sha which can be stale when commits land between CI start and release trigger, (2) skip release if computed version matches what's already in source files.
1 parent ff15fa8 commit 9f9e238

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2020
with:
21-
ref: ${{ github.event.workflow_run.head_sha }}
21+
ref: main
2222
fetch-depth: 0
2323
token: ${{ secrets.GITHUB_TOKEN }}
2424

@@ -45,6 +45,14 @@ jobs:
4545
ver="${major}.${minor}.$((patch + 1))"
4646
fi
4747
48+
# Skip if computed version matches what's already in source
49+
current=$(grep -Po '(?<=^__version__ = ")[^"]+' src/opendata_sdk/_version.py)
50+
if [ "$ver" = "$current" ]; then
51+
echo "skip=true" >> "$GITHUB_OUTPUT"
52+
echo "Computed version ${ver} matches current, skipping"
53+
exit 0
54+
fi
55+
4856
echo "version=${ver}" >> "$GITHUB_OUTPUT"
4957
echo "skip=false" >> "$GITHUB_OUTPUT"
5058
echo "Next version: ${ver}"

0 commit comments

Comments
 (0)