|
16 | 16 | - MCPForUnity/Editor/** |
17 | 17 | - MCPForUnity/Runtime/** |
18 | 18 | - .github/workflows/unity-tests.yml |
| 19 | + # Same-repo PRs get a unity-tests status check on every open / push via this trigger |
| 20 | + # (mirrors python-tests.yml). Fork PRs ALSO fire this trigger but run in the fork's |
| 21 | + # context without secrets — the detect step downstream writes unity_ok=false and the |
| 22 | + # job exits clean with a "missing license secrets" notice so the status check still |
| 23 | + # appears. Maintainers apply 'safe-to-test' to invoke pull_request_target below for |
| 24 | + # a real fork-PR test run. |
| 25 | + pull_request: |
| 26 | + branches: [main, beta] |
| 27 | + paths: |
| 28 | + - TestProjects/UnityMCPTests/** |
| 29 | + - MCPForUnity/Editor/** |
| 30 | + - MCPForUnity/Runtime/** |
| 31 | + - .github/workflows/unity-tests.yml |
19 | 32 | # Fork PRs: maintainer applies the 'safe-to-test' label after reviewing |
20 | 33 | # the diff. The workflow runs with UNITY_LICENSE in scope against the |
21 | 34 | # PR's head SHA. Re-pushed commits do NOT auto-trigger — maintainer must |
|
29 | 42 | - MCPForUnity/Runtime/** |
30 | 43 | - .github/workflows/unity-tests.yml |
31 | 44 |
|
| 45 | +# Dedup runs for the same branch across push / pull_request / pull_request_target / workflow_call. |
| 46 | +# Same-repo PRs would otherwise fire both push (on the branch SHA) AND pull_request (on the PR); |
| 47 | +# concurrency keeps only the newer in-flight run per branch. |
| 48 | +concurrency: |
| 49 | + group: unity-tests-${{ github.head_ref || github.ref }} |
| 50 | + cancel-in-progress: true |
| 51 | + |
32 | 52 | jobs: |
33 | 53 | matrix: |
34 | 54 | name: Compute Unity version matrix |
@@ -71,12 +91,12 @@ jobs: |
71 | 91 | run: | |
72 | 92 | set -euo pipefail |
73 | 93 | # Full matrix on: beta push, workflow_call (release pipelines), workflow_dispatch, |
74 | | - # or any PR labeled with 'full-matrix'. |
| 94 | + # or any PR (pull_request OR pull_request_target) labeled with 'full-matrix'. |
75 | 95 | # Default (single defaultVersion from tools/unity-versions.json) otherwise — fast PR feedback. |
76 | 96 | if [[ "$EVENT_NAME" == "workflow_dispatch" ]] || \ |
77 | 97 | [[ "$EVENT_NAME" == "workflow_call" ]] || \ |
78 | 98 | { [[ "$EVENT_NAME" == "push" ]] && [[ "$GH_REF" == "refs/heads/beta" ]]; } || \ |
79 | | - { [[ "$EVENT_NAME" == "pull_request_target" ]] && [[ "$FULL_MATRIX_LABEL" == "true" ]]; }; then |
| 99 | + { { [[ "$EVENT_NAME" == "pull_request" ]] || [[ "$EVENT_NAME" == "pull_request_target" ]]; } && [[ "$FULL_MATRIX_LABEL" == "true" ]]; }; then |
80 | 100 | versions=$(jq -c '[.versions[].id]' tools/unity-versions.json) |
81 | 101 | echo "Trigger '$EVENT_NAME' on ref '$GH_REF' (full_matrix_label=$FULL_MATRIX_LABEL) → full matrix: $versions" |
82 | 102 | else |
|
0 commit comments