Repository navigation
ci: add notify-downstream workflow - #2
Conversation
Notifies downstream dependents (meta_cli, meta_git_cli, meta_project_cli, meta_rust_cli) via repository_dispatch when CI passes on main. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughA new GitHub Actions workflow triggers on pushes to Changes
Sequence Diagram(s)sequenceDiagram
actor Developer
participant GitHub as GitHub (Push Event)
participant Actions as GitHub Actions Workflow
participant CI as CI Check (ubuntu-latest)
participant Repo as Repository
participant Downstream as Downstream Repos (5 targets)
Developer->>GitHub: Push to main
GitHub->>Actions: Trigger notify-downstream workflow
rect rgba(100,150,200,0.5)
Actions->>CI: wait-for-ci job polls check status
CI-->>Actions: Check complete
end
rect rgba(150,200,100,0.5)
Actions->>Repo: Checkout repository
Repo-->>Actions: Code and metadata
Actions->>Actions: Extract commit SHA, short SHA, message, actor
Actions->>Actions: Infer type from commit prefix (feat/fix/chore/docs/test/refactor/other)
end
rect rgba(200,150,100,0.5)
Actions->>Downstream: Dispatch repository events to 5 targets with payload (repo, repo_name, sha, short_sha, message, type, actor)
Downstream-->>Actions: Events received
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Fix all issues with AI agents
In @.github/workflows/notify-downstream.yml:
- Around line 44-110: Replace the four duplicated repository-dispatch steps with
a single matrix-based job (e.g., job name notify) that defines a
strategy.matrix.repo containing the list of downstream repos and a single step
"Notify ${{ matrix.repo }}" that uses peter-evans/repository-dispatch@v3; keep
the existing commit extraction step (id: commit) and reuse its outputs
(steps.commit.outputs.sha, short_sha, message, type) in the client-payload, set
strategy.fail-fast: false so one failure doesn't stop other notifications, and
update the repository field to use ${{ matrix.repo }}.
- Around line 8-17: The wait-for-ci job currently lacks a job timeout and
doesn't restrict which CI conclusions are accepted; update the wait-for-ci job
to include a job-level timeout-minutes (e.g., 30) to avoid indefinite runs and
add the action input allowed-conclusions (set to only "success") to the
lewagon/wait-on-check-action invocation so the workflow proceeds only when the
named check (check-name input) passes; keep existing inputs (ref, repo-token,
wait-interval) intact and only add timeout-minutes on the job and
allowed-conclusions to the action.
- Around line 23-26: The workflow currently performs a full clone by setting
fetch-depth: 0 on the actions/checkout@v4 step; change the Checkout step to use
fetch-depth: 1 to perform a shallow clone (only the HEAD commit) for faster
execution and reduced network/storage, i.e. update the fetch-depth value in the
Checkout action configuration.
- Around line 28-42: The commit extraction step (step id "commit") writes raw
commit message to the "message" output which later gets interpolated into JSON
payloads, causing JSON injection when the message contains quotes/newlines;
replace this by adding a JSON-escaped output (e.g., "message_escaped") produced
by piping MSG through a JSON-escaper (jq -R -s -c `@json` or equivalent) and write
that escaped value to GITHUB_OUTPUT, then update downstream payloads (where the
current "message" output is used) to consume commit.message_escaped without
adding extra quotes so the payloads remain valid JSON.
- Line 12: Update the GitHub Actions step that references
lewagon/wait-on-check-action by changing the pinned version from v1.3.4 to
v1.5.0 (the line containing "uses: lewagon/wait-on-check-action@v1.3.4"); this
will apply the security fix (rexml bump) and enable the new fail-on-no-checks
feature—ensure the single uses entry is updated to "@v1.5.0" and run/validate
the workflow after the change.
- Update lewagon/wait-on-check-action v1.3.4 → v1.5.0 - Use toJSON() in client-payload to prevent JSON injection - Tighten commit type regex (^feat → ^feat[:(]) - Use shallow clone (remove fetch-depth: 0) - Use matrix strategy for downstream notifications Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/notify-downstream.yml:
- Around line 41-48: The conditional regexes that test MSG (the if/elif block
that echoes type based on commit message) are too strict and miss variants with
a breaking-change bang (e.g., feat! or feat!(scope)): update each pattern (the
tests for "feat", "fix", "chore", "docs", "test", "refactor") to allow an
optional "!" immediately after the type before the delimiter by inserting an
optional-bang token between the type and the delimiter (so the pattern accepts
e.g. feat!, feat!(scope), feat:, feat(scope), etc.); keep the rest of the match
(delimiter check) the same and apply the same change for all listed types in
that if/elif block.
| if [[ "$MSG" =~ ^feat[:(] ]]; then echo "type=feat" >> $GITHUB_OUTPUT | ||
| elif [[ "$MSG" =~ ^fix[:(] ]]; then echo "type=fix" >> $GITHUB_OUTPUT | ||
| elif [[ "$MSG" =~ ^chore[:(] ]]; then echo "type=chore" >> $GITHUB_OUTPUT | ||
| elif [[ "$MSG" =~ ^docs[:(] ]]; then echo "type=docs" >> $GITHUB_OUTPUT | ||
| elif [[ "$MSG" =~ ^test[:(] ]]; then echo "type=test" >> $GITHUB_OUTPUT | ||
| elif [[ "$MSG" =~ ^refactor[:(] ]]; then echo "type=refactor" >> $GITHUB_OUTPUT | ||
| else echo "type=other" >> $GITHUB_OUTPUT | ||
| fi |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Regex may miss valid conventional commit variants.
The pattern ^feat[:(] requires the type to be immediately followed by : or (. This misses valid conventional commit formats like:
feat!: breaking change(breaking change indicator)feat!(<scope>): message(breaking change with scope)
Consider using a more permissive pattern that allows an optional ! before the delimiter:
♻️ Proposed fix
- if [[ "$MSG" =~ ^feat[:(] ]]; then echo "type=feat" >> $GITHUB_OUTPUT
- elif [[ "$MSG" =~ ^fix[:(] ]]; then echo "type=fix" >> $GITHUB_OUTPUT
- elif [[ "$MSG" =~ ^chore[:(] ]]; then echo "type=chore" >> $GITHUB_OUTPUT
- elif [[ "$MSG" =~ ^docs[:(] ]]; then echo "type=docs" >> $GITHUB_OUTPUT
- elif [[ "$MSG" =~ ^test[:(] ]]; then echo "type=test" >> $GITHUB_OUTPUT
- elif [[ "$MSG" =~ ^refactor[:(] ]]; then echo "type=refactor" >> $GITHUB_OUTPUT
+ if [[ "$MSG" =~ ^feat[\!\(\:] ]]; then echo "type=feat" >> $GITHUB_OUTPUT
+ elif [[ "$MSG" =~ ^fix[\!\(\:] ]]; then echo "type=fix" >> $GITHUB_OUTPUT
+ elif [[ "$MSG" =~ ^chore[\!\(\:] ]]; then echo "type=chore" >> $GITHUB_OUTPUT
+ elif [[ "$MSG" =~ ^docs[\!\(\:] ]]; then echo "type=docs" >> $GITHUB_OUTPUT
+ elif [[ "$MSG" =~ ^test[\!\(\:] ]]; then echo "type=test" >> $GITHUB_OUTPUT
+ elif [[ "$MSG" =~ ^refactor[\!\(\:] ]]; then echo "type=refactor" >> $GITHUB_OUTPUT🤖 Prompt for AI Agents
In @.github/workflows/notify-downstream.yml around lines 41 - 48, The
conditional regexes that test MSG (the if/elif block that echoes type based on
commit message) are too strict and miss variants with a breaking-change bang
(e.g., feat! or feat!(scope)): update each pattern (the tests for "feat", "fix",
"chore", "docs", "test", "refactor") to allow an optional "!" immediately after
the type before the delimiter by inserting an optional-bang token between the
type and the delimiter (so the pattern accepts e.g. feat!, feat!(scope), feat:,
feat(scope), etc.); keep the rest of the match (delimiter check) the same and
apply the same change for all listed types in that if/elif block.
The Cargo.toml uses edition.workspace, version.workspace, etc. but CI had no workspace root, causing all builds to fail since the config refactoring. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
notify-downstream.ymlworkflow that dispatchesdependency-updatedevents to downstream dependents (meta_cli,meta_git_cli,meta_project_cli,meta_rust_cli) after CI passes on mainTest plan
🤖 Generated with Claude Code
Summary by CodeRabbit