Skip to content

ci: stop firing unity-tests/python-tests twice on beta and main pushes#1147

Merged
Scriptwonder merged 1 commit into
CoplayDev:betafrom
Scriptwonder:ci/avoid-duplicate-test-runs-on-beta
May 22, 2026
Merged

ci: stop firing unity-tests/python-tests twice on beta and main pushes#1147
Scriptwonder merged 1 commit into
CoplayDev:betafrom
Scriptwonder:ci/avoid-duplicate-test-runs-on-beta

Conversation

@Scriptwonder
Copy link
Copy Markdown
Collaborator

@Scriptwonder Scriptwonder commented May 22, 2026

A push to beta (or main) that touches MCPForUnity/** or Server/** fires the test workflow through two paths at once:

push to beta ─┬─► unity-tests.yml  (direct push trigger, branches: ["**"])
              │
              └─► beta-release.yml ──workflow_call──► unity-tests.yml

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.yml and python-tests.yml to branches-ignore: [beta, main]. Beta and main are already covered through workflow_call from beta-release.yml and release.yml respectively, 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_dispatch invocations are unaffected.

Summary by CodeRabbit

  • Chores
    • Optimized CI/CD workflow configurations to prevent redundant test executions on protected branches, improving build efficiency.

Review Change Stack

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.
Copilot AI review requested due to automatic review settings May 22, 2026 15:30
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

📝 Walkthrough

Walkthrough

GitHub Actions workflows for Python and Unity tests are updated to exclude beta and main branches from push triggers, replacing catch-all configurations to prevent duplicate test runs on those protected branches.

Changes

Workflow Push Trigger Configuration

Layer / File(s) Summary
Exclude beta and main branches from push triggers
.github/workflows/python-tests.yml, .github/workflows/unity-tests.yml
Python and Unity test workflows now use branches-ignore: [beta, main] to prevent push triggers on those branches, replacing the prior branches: ["**"] catch-all configuration.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • CoplayDev/unity-mcp#628: Modifies GitHub Actions workflow on.push branch filters to exclude the beta branch in test workflows.
  • CoplayDev/unity-mcp#1108: Adjusts .github/workflows/unity-tests.yml GitHub Actions on trigger configuration including push branch filtering.
  • CoplayDev/unity-mcp#1143: Modifies .github/workflows/unity-tests.yml trigger configuration to refine on.push branch handling.

Poem

🐰 A rabbit hops through workflows bright,
Filtering branches left and right!
No beta, main shall trigger fast,
Only feature branches unsurpassed. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: preventing duplicate test workflow executions on beta and main branches by modifying push triggers.
Description check ✅ Passed The description explains the problem, solution, and impact clearly, but lacks formal structure matching the template (no explicit Type of Change, Changes Made, or Related Issues sections).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5d8b7be and 09daa42.

📒 Files selected for processing (2)
  • .github/workflows/python-tests.yml
  • .github/workflows/unity-tests.yml

Comment on lines +5 to +9
# 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]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 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"
fi

Repository: 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"
fi

Repository: 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' || true

Repository: 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' || true

Repository: 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'
done

Repository: 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' || true

Repository: 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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.yml push trigger to ignore beta and main.
  • Update python-tests.yml push trigger to ignore beta and main.
  • 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.group later (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: (unlike unity-tests.yml), so duplicate runs from push + workflow_call would 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.

Comment on lines +13 to +19
# 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]
Comment on lines +5 to +9
# 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]
@Scriptwonder Scriptwonder merged commit 63a7979 into CoplayDev:beta May 22, 2026
8 checks passed
@Scriptwonder Scriptwonder deleted the ci/avoid-duplicate-test-runs-on-beta branch May 22, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants