Skip to content

Commit 24fd458

Browse files
committed
Add assertion test to enforce action.yml update on release
Signed-off-by: lelia <lelia@socket.dev>
1 parent 9217e6e commit 24fd458

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

.github/workflows/python-tests.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ on:
88
- "tests/**/*.py"
99
- "pyproject.toml"
1010
- "uv.lock"
11+
- "action.yml"
1112
- ".github/workflows/python-tests.yml"
1213
pull_request:
1314
paths:
1415
- "socket_basics/**/*.py"
1516
- "tests/**/*.py"
1617
- "pyproject.toml"
1718
- "uv.lock"
19+
- "action.yml"
1820
- ".github/workflows/python-tests.yml"
1921
workflow_dispatch:
2022

@@ -49,5 +51,28 @@ jobs:
4951
V_TOML=$(python -c "import tomllib; print(tomllib.loads(open('pyproject.toml').read())['project']['version'])")
5052
[ "$V_PY" = "$V_TOML" ] || (echo "Version mismatch: version.py=$V_PY pyproject.toml=$V_TOML" && exit 1)
5153
echo "Version in sync: $V_PY"
54+
55+
- name: 🔒 Assert action.yml image ref matches version (once switched to pre-built)
56+
run: |
57+
python3 - <<'EOF'
58+
import re, sys, tomllib
59+
from pathlib import Path
60+
61+
action = Path("action.yml").read_text()
62+
version = tomllib.loads(Path("pyproject.toml").read_text())["project"]["version"]
63+
64+
match = re.search(r'image:\s*["\']docker://[^:]+:([^"\']+)["\']', action)
65+
if not match:
66+
print(f"SKIP: action.yml still uses Dockerfile — check will activate once switched to pre-built image")
67+
sys.exit(0)
68+
69+
action_version = match.group(1)
70+
if action_version != version:
71+
print(f"FAIL: action.yml refs {action_version} but version is {version}")
72+
print(f" Update action.yml image ref to docker://ghcr.io/socketdev/socket-basics:{version}")
73+
sys.exit(1)
74+
75+
print(f"OK: action.yml image ref matches version {version}")
76+
EOF
5277
- name: 🧪 Run tests
5378
run: pytest -q tests/

0 commit comments

Comments
 (0)