Skip to content

Commit aa5b03d

Browse files
songoowclaude
andcommitted
test(ci): pin the sonar job structurally, allowing the merge-queue skip
The sonar caller check matched the literal text 'needs: pytest' followed by 'uses:', so adding the merge_group skip between them failed it. Parse the job instead: it still must need this run's pytest job and call the local reusable workflow, and its only condition may be the merge_group skip, so a status function such as always() cannot run analysis without same-run coverage. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: song <22676124+songoow@users.noreply.github.com>
1 parent 3f0c348 commit aa5b03d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎tests/test_sonarcloud_workflow.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from pathlib import Path
55

66
import pytest
7+
import yaml
78

89
WORKFLOW = Path(__file__).resolve().parents[1] / ".github" / "workflows" / "sonarcloud.yml"
910

@@ -71,6 +72,12 @@ def test_sonar_reuses_same_run_coverage_without_a_privileged_trigger() -> None:
7172
assert "name: python-coverage-xml" in workflow
7273
assert "run-id:" not in workflow
7374
assert "github-token:" not in workflow
74-
assert "needs: pytest\n uses: ./.github/workflows/sonarcloud.yml" in caller
75+
sonar = yaml.safe_load(caller)["jobs"]["sonar"]
76+
# Coverage comes from this run's pytest job, handed to the local reusable
77+
# workflow. The only condition may skip merge-queue refs; a status function
78+
# such as always() would let analysis run without that coverage.
79+
assert sonar["needs"] == "pytest"
80+
assert sonar["uses"] == "./.github/workflows/sonarcloud.yml"
81+
assert sonar.get("if") == "github.event_name != 'merge_group'"
7582
assert '"apps/**"' in caller
7683
assert '"sonar-project.properties"' in caller

0 commit comments

Comments
 (0)