-
Notifications
You must be signed in to change notification settings - Fork 1
fix: restrict cross-repo release gate token to push #600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,8 @@ | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| from pathlib import Path | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| import yaml | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| WORKFLOW = Path(".github/workflows/quality-wall.yml") | ||||||||||||||||||||||
| REQUIRED_CHECKS = Path("docs/process/REQUIRED_CHECKS.md") | ||||||||||||||||||||||
|
|
@@ -58,6 +60,21 @@ def test_release_gate_workflow_does_not_publish() -> None: | |||||||||||||||||||||
| assert "releases/manifest|docs/releases/" not in workflow | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def test_cross_repo_release_gate_token_is_not_exposed_to_pull_request_code() -> None: | ||||||||||||||||||||||
| workflow = yaml.safe_load(WORKFLOW.read_text(encoding="utf-8")) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| release_gate_steps = workflow["jobs"]["release-gate"]["steps"] | ||||||||||||||||||||||
| cross_repo_gate_step = next( | ||||||||||||||||||||||
| step | ||||||||||||||||||||||
| for step in release_gate_steps | ||||||||||||||||||||||
| if step.get("name") == "Run v0.23 cross-repo release gate snapshot" | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
|
Comment on lines
+67
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| assert cross_repo_gate_step["if"] == "${{ github.event_name == 'push' }}" | ||||||||||||||||||||||
| assert cross_repo_gate_step["env"]["GH_TOKEN"] == "${{ secrets.YONERAI_RELEASE_GATE_TOKEN || github.token }}" | ||||||||||||||||||||||
| assert "python scripts/yonerai_release_gate.py --release-issue 592" in cross_repo_gate_step["run"] | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def test_required_checks_doc_lists_quality_wall_jobs() -> None: | ||||||||||||||||||||||
| doc = REQUIRED_CHECKS.read_text(encoding="utf-8") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the checked
release-gateworkflow path, dependencies are installed withpython -m pip install -e clients/cli pytest, and neither that package nor the requirements used by this job declare PyYAML; this new top-level import makespython -m pytest tests/test_quality_wall_workflow.py -qfail during collection withModuleNotFoundError: No module named 'yaml'. Please either keep this test on stdlib/string checks or install/declare PyYAML for the job that runs it.Useful? React with 👍 / 👎.