|
8 | 8 | workflow_dispatch: |
9 | 9 | inputs: |
10 | 10 | oss_conductor_version: |
11 | | - description: 'OSS Conductor image tag (falls back to E2E_TEST_OSS_CONDUCTOR_VERSION org var)' |
| 11 | + description: 'OSS Conductor image tag (falls back to E2E_TEST_OSS_CONDUCTOR_VERSION org var, then to a pinned default on fork PRs)' |
12 | 12 | required: false |
13 | 13 | type: string |
14 | 14 |
|
@@ -99,16 +99,41 @@ jobs: |
99 | 99 | env: |
100 | 100 | CONDUCTOR_SERVER_URL: http://localhost:8080/api |
101 | 101 | CONDUCTOR_SERVER_TYPE: oss |
102 | | - OSS_CONDUCTOR_VERSION: ${{ inputs.oss_conductor_version || vars.E2E_TEST_OSS_CONDUCTOR_VERSION }} |
| 102 | + # Used only when the org variable is unreachable because the run is a fork |
| 103 | + # PR -- see the resolve step below. |
| 104 | + FORK_PR_FALLBACK_VERSION: '3.32.3' |
103 | 105 |
|
104 | 106 | steps: |
105 | | - - name: Verify OSS Conductor version is set |
| 107 | + # OSS_CONDUCTOR_VERSION is resolved here rather than in the job `env` so |
| 108 | + # that the two ways it can come back empty get different treatment: |
| 109 | + # |
| 110 | + # - Fork PR: GitHub withholds org/repo variables from pull_request runs |
| 111 | + # on forks exactly as it withholds secrets, so vars.* is always "" for |
| 112 | + # an outside contributor (observed in csharp-sdk#178). This job needs |
| 113 | + # no secrets, only a tag, so pin one and keep running. Note that the |
| 114 | + # workflow_run trigger above executes in the base repo's context and |
| 115 | + # does get the org variable even for a fork PR; the fork branch here |
| 116 | + # matters for the push/dispatch paths and for any future direct |
| 117 | + # pull_request trigger. |
| 118 | + # - Anything else: the org variable is genuinely missing or its |
| 119 | + # repository access policy no longer covers this repo. Fail loudly |
| 120 | + # rather than silently drifting onto the pin. |
| 121 | + - name: Resolve OSS Conductor version |
| 122 | + env: |
| 123 | + REQUESTED_VERSION: ${{ inputs.oss_conductor_version || vars.E2E_TEST_OSS_CONDUCTOR_VERSION }} |
| 124 | + IS_FORK_PR: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || (github.event_name == 'workflow_run' && github.event.workflow_run.head_repository.full_name != github.repository) }} |
106 | 125 | run: | |
107 | | - if [ -z "$OSS_CONDUCTOR_VERSION" ]; then |
| 126 | + if [ -n "$REQUESTED_VERSION" ]; then |
| 127 | + resolved="$REQUESTED_VERSION" |
| 128 | + elif [ "$IS_FORK_PR" = "true" ]; then |
| 129 | + resolved="$FORK_PR_FALLBACK_VERSION" |
| 130 | + echo "::notice::Fork PR: org variables are withheld, pinning conductoross/conductor:${resolved}" |
| 131 | + else |
108 | 132 | echo "::error::No Conductor OSS image tag resolved. Set the E2E_TEST_OSS_CONDUCTOR_VERSION organization variable (and ensure its repository access policy includes this repo), or pass the oss_conductor_version input via workflow_dispatch." |
109 | 133 | exit 1 |
110 | 134 | fi |
111 | | - echo "Using conductoross/conductor:$OSS_CONDUCTOR_VERSION" |
| 135 | + echo "OSS_CONDUCTOR_VERSION=${resolved}" >> "$GITHUB_ENV" |
| 136 | + echo "Using conductoross/conductor:${resolved}" |
112 | 137 |
|
113 | 138 | - name: Checkout |
114 | 139 | uses: actions/checkout@v6 |
|
0 commit comments