Skip to content

Commit fc4627a

Browse files
authored
ci: simplify extension check - always require version bump (#941)
See CQCL/hugr#2380
1 parent 8ed00b2 commit fc4627a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,13 @@ jobs:
329329
# Check against latest tag on the target branch
330330
# When not on a pull request, base_ref should be empty so we default to HEAD
331331
if [ -z "$TARGET_REF" ]; then
332-
BASE_SHA=""
332+
BASE_SHA="HEAD~1"
333333
else
334334
BASE_SHA=$(git rev-parse origin/$TARGET_REF)
335335
fi
336-
LAST_TAG=$(git describe --abbrev=0 --match="tket2-*" $BASE_SHA)
337-
echo "Latest tag on target: $LAST_TAG"
336+
echo "Comparing to ref: $BASE_SHA"
338337
339-
python ./scripts/check_extension_versions.py $LAST_TAG
338+
python ./scripts/check_extension_versions.py $BASE_SHA
340339
env:
341340
TARGET_REF: ${{ github.base_ref }}
342341

scripts/check_extension_versions.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ def check_version_changes(changed_files: list[Path], target: str) -> list[str]:
4848

4949
if current_version == target_version:
5050
errors.append(
51-
f"Error: {file_path} was modified but version {current_version} was not updated."
51+
f"Error: {file_path} was modified but version {current_version}"
52+
" was not updated."
5253
)
5354
else:
5455
print(
55-
f"Version updated in {file_path}: {target_version} -> {current_version}"
56+
f"Version updated in {file_path}: {target_version}"
57+
f" -> {current_version}"
5658
)
5759

5860
else:
@@ -62,7 +64,6 @@ def check_version_changes(changed_files: list[Path], target: str) -> list[str]:
6264
except json.JSONDecodeError:
6365
# File is new or not valid JSON in target
6466
pass
65-
6667
return errors
6768

6869

@@ -78,7 +79,7 @@ def main() -> int:
7879
errors = check_version_changes(changed_files, target)
7980
if errors:
8081
for error in errors:
81-
print(error)
82+
sys.stderr.write(error)
8283
return 1
8384

8485
print("All changed extension files have updated versions.")

0 commit comments

Comments
 (0)