Repository navigation
ci: use the shared CI gate action - #342
Conversation
Replace the jq script of the gate job (`passed`, "CI passed") with the shared `gate` action of elixir-cloud-aai/.github v1.0.0, pinned to its commit. `push` and `publish` may be skipped where `PUBLISH` is "false", as before. The job keeps its name, condition and needs, so the required check is unchanged; it now runs without token permissions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Document the shared gate action and how its pins are bumped, reword the gate's comment, and mark the check for local actions that #329 adds. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #342 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 27 27
Lines 2195 2195
=========================================
Hits 2195 2195 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Reviewer's GuideThe PR migrates the required CI gate from a local jq script to the shared, pinned Flow diagram for the shared CI gate evaluationflowchart TD
Jobs[CI jobs in needs] --> Gate[Shared gate action]
Gate --> Results{All results acceptable?}
Results -->|success| Passed[CI passed]
Results -->|skipped push or publish when PUBLISH is false| Passed
Results -->|failure, cancelled, or unintended skip| Failed[Gate fails]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
@sourcery-ai review |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/test_workflows.py" line_range="117" />
<code_context>
+ gate = _load(WORKFLOWS / "ci.yml")["jobs"][GATE]
+ assert gate["permissions"] == {}
+ (step,) = gate["steps"]
+ assert step["uses"].startswith("elixir-cloud-aai/.github/actions/gate@")
+ assert step["with"]["needs"] == "${{ toJSON(needs) }}"
+ assert step["with"]["allow-skipped"] == (
</code_context>
<issue_to_address>
**Wrong gate action passes validation**
When the workflow's action path is changed to another valid shared action whose name starts with `gate`, `test_gate_uses_shared_action` accepts any action path beginning with `elixir-cloud-aai/.github/actions/gate`, such as `gate-fallback`; the pin and release-comment tests also accept that name, so the tests pass while CI invokes a different action.
Assert the exact shared action path, allowing only the intended SHA ref after `gate@`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and if the shared action handles job results or the skip allowlist incorrectly, the required CI check could pass despite a failed or unexpectedly skipped job, allowing code to merge without the intended checks. Reverting restores the inline gate, but it cannot undo a merge that already happened.
Blocking findings: tests/test_workflows.py:117
Summary
The gate job of CI (
passed, "CI passed") now runs the sharedgateaction of elixir-cloud-aai/.github v1.0.0, pinned to its commit, instead of its own jq script. Cloud Registry uses the same action.needs: ${{ toJSON(needs) }}. It setsallow-skippedtopush publishonly wherePUBLISHis "false" (on pull requests, and in forks withoutDOCKERHUB_ORG), which is the old rule.if: always()andneeds, so the required check doesn't change and the ruleset needs no update.permissions: {}, because the action needs no token.tests/test_workflows.pynow checks that the gate uses the shared action with these inputs and no permissions, and that every shared action is pinned to the same SHA with a# vX.Y.Zcomment, as in Cloud Registry's tests. The check that no workflow uses a local action follows in ci: use the shared scan-image action #329, which drops the localscan-imageaction.docs/development.mddescribes the shared gate and how its pins are bumped together, which Dependabot does.Closes #330
Verification
pytest tests/test_workflows.py: 9 passed. Against the oldci.yml, 3 of them fail, so they were written first.actionlint1.7.12: passed.pre-commit run --all-files: passed. Locally, the actionlint hook ran as the standalone binary instead, because the hook's download was cut off.mypy: passed.mkdocs build --strict: passed.permissionschange).needs. All behaved as the old script did, or stricter.Declined review findings
allow-skippedinstead of the literal expression: the test pins the literal expression, as Cloud Registry's test does.Open questions
None.
🤖 Generated with Claude Code