ci: stop firing unity-tests/python-tests twice on beta and main pushes#1147
Conversation
A push to beta (or main) that touches MCPForUnity/** or Server/** triggers
the test workflow via two paths:
push to beta ─┬─► unity-tests.yml (direct push trigger, branches: ["**"])
│
└─► beta-release.yml ──workflow_call──► unity-tests.yml
Both invocations land in GitHub's auto-generated concurrency group
`unity-tests-refs/heads/beta`, so the later one cancels the earlier with
the noisy "Canceling since a higher priority waiting request for
unity-tests-refs/heads/beta exists" annotation. The cancelled run shows
red on the Actions page even though the workflow_call sibling completed
fine.
Switch the direct push trigger to `branches-ignore: [beta, main]` on both
unity-tests.yml and python-tests.yml. Coverage on those branches is still
delivered through workflow_call from beta-release.yml / release.yml; we
just stop firing a duplicate run that gets killed by concurrency. PR
checks, feature-branch pushes, and manual workflow_dispatch invocations
are unaffected.
📝 WalkthroughWalkthroughGitHub Actions workflows for Python and Unity tests are updated to exclude ChangesWorkflow Push Trigger Configuration
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/python-tests.yml:
- Around line 5-9: The inline comment explaining why branches-ignore excludes
beta and main is misleading; update it to explicitly state that this workflow
declares on: workflow_call and is invoked by other workflows (beta-release.yml
and release.yml), so branches-ignore: [beta, main] prevents duplicate runs when
those callers trigger the reusable python-tests workflow; modify the comment
text around branches-ignore to reflect that the exclusion is intentional because
of workflow_call usage rather than removing the exclusion or changing triggers.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: bef92f30-4046-49b8-b201-eccf6ee8c029
📒 Files selected for processing (2)
.github/workflows/python-tests.yml.github/workflows/unity-tests.yml
| # Exclude beta and main: those branches re-trigger this workflow via | ||
| # workflow_call from beta-release.yml / release.yml. Without the exclusion, | ||
| # a push to beta that touches Server/** fires this workflow twice for the | ||
| # same SHA, and GitHub auto-cancels the duplicate. | ||
| branches-ignore: [beta, main] |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Verify that beta-release.yml and release.yml call python-tests.yml
echo "=== Checking beta-release.yml ==="
if [ -f .github/workflows/beta-release.yml ]; then
echo "File exists. Searching for python-tests workflow_call..."
rg -n "uses:.*python-tests" .github/workflows/beta-release.yml || echo "No direct 'uses' found, checking for workflow references..."
rg -n -C3 "python-tests\.yml" .github/workflows/beta-release.yml || echo "⚠️ No reference to python-tests.yml found"
else
echo "⚠️ beta-release.yml not found"
fi
echo ""
echo "=== Checking release.yml ==="
if [ -f .github/workflows/release.yml ]; then
echo "File exists. Searching for python-tests workflow_call..."
rg -n "uses:.*python-tests" .github/workflows/release.yml || echo "No direct 'uses' found, checking for workflow references..."
rg -n -C3 "python-tests\.yml" .github/workflows/release.yml || echo "⚠️ No reference to python-tests.yml found"
else
echo "⚠️ release.yml not found"
fiRepository: CoplayDev/unity-mcp
Length of output: 716
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== on: section (beta-release.yml) ==="
if [ -f .github/workflows/beta-release.yml ]; then
awk 'BEGIN{p=0}
/^on:/{p=1}
p{print}
p && /^jobs:/{exit}' .github/workflows/beta-release.yml | sed -n '1,200p'
echo
echo "=== branches filters (beta-release.yml) ==="
rg -n "branches" .github/workflows/beta-release.yml || true
else
echo "beta-release.yml not found"
fi
echo
echo "=== on: section (release.yml) ==="
if [ -f .github/workflows/release.yml ]; then
awk 'BEGIN{p=0}
/^on:/{p=1}
p{print}
p && /^jobs:/{exit}' .github/workflows/release.yml | sed -n '1,200p'
echo
echo "=== branches filters (release.yml) ==="
rg -n "branches" .github/workflows/release.yml || true
else
echo "release.yml not found"
fiRepository: CoplayDev/unity-mcp
Length of output: 710
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== python-tests.yml on: section ==="
awk 'BEGIN{p=0}
/^on:/{p=1}
p{print}
p && /^jobs:/{exit}' .github/workflows/python-tests.yml | sed -n '1,220p'
echo
echo "=== Does python-tests.yml define workflow_call? ==="
rg -n "workflow_call" .github/workflows/python-tests.yml || true
echo
echo "=== Any other workflows calling release.yml (workflow_call uses release.yml) ==="
rg -n "uses: \./\.github/workflows/release\.yml" .github/workflows --glob='*.yml' || true
echo
echo "=== Any other workflows calling beta-release.yml (workflow_call uses beta-release.yml) ==="
rg -n "uses: \./\.github/workflows/beta-release\.yml" .github/workflows --glob='*.yml' || trueRepository: CoplayDev/unity-mcp
Length of output: 1157
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== workflows that reference release.yml ==="
rg -n "uses:\s*\./\.github/workflows/release\.yml" .github/workflows --glob='*.yml' || true
echo
echo "=== workflows that reference beta-release.yml ==="
rg -n "uses:\s*\./\.github/workflows/beta-release\.yml" .github/workflows --glob='*.yml' || true
echo
echo "=== any plain mentions of release.yml in workflow_call contexts ==="
rg -n "workflow_call:[\s\S]{0,600}?release\.yml" .github/workflows --glob='*.yml' || true
echo
echo "=== any plain mentions of beta-release.yml in workflow_call contexts ==="
rg -n "workflow_call:[\s\S]{0,600}?beta-release\.yml" .github/workflows --glob='*.yml' || trueRepository: CoplayDev/unity-mcp
Length of output: 302
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== All jobs.*.uses references to python-tests.yml ==="
rg -n "uses:\s*\./\.github/workflows/python-tests\.yml" .github/workflows --glob='*.yml' || true
echo
echo "=== For each referencing workflow, show its on: block (first ~80 lines) ==="
# Get unique workflow filenames from rg matches
rg -l "uses:\s*\./\.github/workflows/python-tests\.yml" .github/workflows --glob='*.yml' | sort | while read -r f; do
echo
echo "---- ${f} : on: block ----"
awk 'BEGIN{p=0}
/^on:/{p=1}
p{print}
p && /^jobs:/{exit}' "$f" | sed -n '1,120p'
doneRepository: CoplayDev/unity-mcp
Length of output: 869
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== Any mentions of python-tests.yml in workflows ==="
rg -n "python-tests\.yml" .github/workflows --glob='*.yml' || true
echo
echo "=== Any uses: references to python-tests.yml (path variations) ==="
rg -n "uses:\s*.*python-tests\.yml" .github/workflows --glob='*.yml' || trueRepository: CoplayDev/unity-mcp
Length of output: 800
Update: beta-release.yml and release.yml call the reusable python-tests workflow
beta-release.yml and release.yml both invoke .github/workflows/python-tests.yml via jobs.*.uses (python-tests.yml declares on: workflow_call and both callers use it). Also, python-tests.yml’s push trigger explicitly ignores beta and main (branches-ignore: [beta, main]), so the “exclude beta/main to avoid duplicate runs” rationale matches the workflow setup.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/python-tests.yml around lines 5 - 9, The inline comment
explaining why branches-ignore excludes beta and main is misleading; update it
to explicitly state that this workflow declares on: workflow_call and is invoked
by other workflows (beta-release.yml and release.yml), so branches-ignore:
[beta, main] prevents duplicate runs when those callers trigger the reusable
python-tests workflow; modify the comment text around branches-ignore to reflect
that the exclusion is intentional because of workflow_call usage rather than
removing the exclusion or changing triggers.
There was a problem hiding this comment.
Pull request overview
This PR updates CI workflow triggers to prevent duplicate unity-tests/python-tests runs on beta/main pushes by excluding those branches from the workflows’ direct push triggers, relying instead on reusable workflow_call invocations from release pipelines.
Changes:
- Update
unity-tests.ymlpush trigger to ignorebetaandmain. - Update
python-tests.ymlpush trigger to ignorebetaandmain. - Add explanatory comments documenting why the branch exclusions exist.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/unity-tests.yml | Ignore beta/main on push to avoid duplicate Unity test workflow invocations. |
| .github/workflows/python-tests.yml | Ignore beta/main on push to avoid duplicate Python test workflow invocations. |
Comments suppressed due to low confidence (2)
.github/workflows/unity-tests.yml:18
- The comment refers to GitHub’s “auto-generated concurrency group” cancelling runs, but this workflow sets an explicit
concurrency.grouplater (unity-tests-${{ github.head_ref || github.ref }}). It may be clearer to attribute cancellations to that configured group so future edits don’t assume GitHub is generating it automatically.
# a push to beta that touches MCPForUnity/** fires this workflow twice
# for the same SHA, and GitHub's auto-generated concurrency group
# (`unity-tests-refs/heads/beta`) cancels the older run with the noisy
# "higher priority waiting request" annotation.
.github/workflows/python-tests.yml:9
- The new comment says “GitHub auto-cancels the duplicate”, but this workflow doesn’t define
concurrency:(unlikeunity-tests.yml), so duplicate runs frompush+workflow_callwould normally both execute rather than cancel. Consider rewording to describe duplicate executions (or add an explicit concurrency group if cancellation is desired).
# Exclude beta and main: those branches re-trigger this workflow via
# workflow_call from beta-release.yml / release.yml. Without the exclusion,
# a push to beta that touches Server/** fires this workflow twice for the
# same SHA, and GitHub auto-cancels the duplicate.
branches-ignore: [beta, main]
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Exclude beta and main: those branches re-trigger this workflow via | ||
| # workflow_call from beta-release.yml / release.yml. Without the exclusion, | ||
| # a push to beta that touches MCPForUnity/** fires this workflow twice | ||
| # for the same SHA, and GitHub's auto-generated concurrency group | ||
| # (`unity-tests-refs/heads/beta`) cancels the older run with the noisy | ||
| # "higher priority waiting request" annotation. | ||
| branches-ignore: [beta, main] |
| # Exclude beta and main: those branches re-trigger this workflow via | ||
| # workflow_call from beta-release.yml / release.yml. Without the exclusion, | ||
| # a push to beta that touches Server/** fires this workflow twice for the | ||
| # same SHA, and GitHub auto-cancels the duplicate. | ||
| branches-ignore: [beta, main] |
A push to
beta(ormain) that touchesMCPForUnity/**orServer/**fires the test workflow through two paths at once:Both invocations end up in GitHub's auto-generated concurrency group
unity-tests-refs/heads/beta, so the later one cancels the earlier with the "Canceling since a higher priority waiting request for unity-tests-refs/heads/beta exists" annotation. The cancelled run shows red on the Actions page even though its workflow_call sibling completed fine — pure noise.Fix is the smallest one I could find: switch the direct push trigger on
unity-tests.ymlandpython-tests.ymltobranches-ignore: [beta, main]. Beta and main are already covered throughworkflow_callfrombeta-release.ymlandrelease.ymlrespectively, so we don't lose coverage — we just stop firing the duplicate run that gets killed by concurrency.PR checks, feature-branch pushes, and manual
workflow_dispatchinvocations are unaffected.Summary by CodeRabbit