feat(ci): repo-branch/repo-commit inputs on main

Runner fetches the composite action from @main. Propagates the
cross-repo branch/commit inputs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Simone
2026-05-17 17:37:20 +02:00
parent ecfe0f3006
commit 61cb6cdb40
+43 -2
View File
@@ -128,6 +128,24 @@ inputs:
required: false required: false
default: '' default: ''
repo-branch:
description: >
Branch to clone in the target repo. Leave empty (default) to use
the workflow's own ref (github.ref_name) — correct only when
repo-url is the same repo as the workflow. Set explicitly (e.g.
"main") for cross-repo builds where repo-url points elsewhere.
required: false
default: ''
repo-commit:
description: >
Commit SHA to check out in the target repo. Leave empty (default)
to use github.sha only when repo-url is NOT overridden; for a
cross-repo build (repo-url set) an empty value means "branch tip,
no pin". Set explicitly to pin a specific commit of the target.
required: false
default: ''
extra-guest-env-json: extra-guest-env-json:
description: > description: >
JSON object of extra environment variables to inject into the build VM JSON object of extra environment variables to inject into the build VM
@@ -189,6 +207,8 @@ runs:
INPUT_ARTIFACT_NAME: ${{ inputs.artifact-name }} INPUT_ARTIFACT_NAME: ${{ inputs.artifact-name }}
INPUT_JOB_ID_SUFFIX: ${{ inputs.job-id-suffix }} INPUT_JOB_ID_SUFFIX: ${{ inputs.job-id-suffix }}
INPUT_REPO_URL: ${{ inputs.repo-url }} INPUT_REPO_URL: ${{ inputs.repo-url }}
INPUT_REPO_BRANCH: ${{ inputs.repo-branch }}
INPUT_REPO_COMMIT: ${{ inputs.repo-commit }}
INPUT_EXTRA_GUEST_ENV_JSON: ${{ inputs.extra-guest-env-json }} INPUT_EXTRA_GUEST_ENV_JSON: ${{ inputs.extra-guest-env-json }}
INPUT_USE_SHARED_CACHE: ${{ inputs.use-shared-cache }} INPUT_USE_SHARED_CACHE: ${{ inputs.use-shared-cache }}
INPUT_SKIP_ARTIFACT: ${{ inputs.skip-artifact }} INPUT_SKIP_ARTIFACT: ${{ inputs.skip-artifact }}
@@ -226,6 +246,27 @@ runs:
$repoUrl = '${{ github.server_url }}/${{ github.repository }}.git' $repoUrl = '${{ github.server_url }}/${{ github.repository }}.git'
} }
# Resolve target branch/commit. github.ref_name/github.sha refer
# to the workflow's own repo — only valid when repo-url is NOT
# overridden. For a cross-repo build the caller must give
# repo-branch (and optionally repo-commit); an unset commit means
# "branch tip, no pin".
if ($env:INPUT_REPO_BRANCH) {
$repoBranch = $env:INPUT_REPO_BRANCH
}
else {
$repoBranch = '${{ github.ref_name }}'
}
if ($env:INPUT_REPO_COMMIT) {
$repoCommit = $env:INPUT_REPO_COMMIT
}
elseif ($env:INPUT_REPO_URL) {
$repoCommit = '' # cross-repo: don't pin the workflow's sha
}
else {
$repoCommit = '${{ github.sha }}'
}
# Resolve guest OS: honor explicit input; for Auto, infer from RUNNER_LABELS # Resolve guest OS: honor explicit input; for Auto, infer from RUNNER_LABELS
$resolvedGuestOS = $env:INPUT_GUEST_OS $resolvedGuestOS = $env:INPUT_GUEST_OS
if ($resolvedGuestOS -eq 'Auto') { if ($resolvedGuestOS -eq 'Auto') {
@@ -262,8 +303,8 @@ runs:
'-m', 'ci_orchestrator', 'job', '-m', 'ci_orchestrator', 'job',
'--job-id', $jobId, '--job-id', $jobId,
'--repo-url', $repoUrl, '--repo-url', $repoUrl,
'--branch', '${{ github.ref_name }}', '--branch', $repoBranch,
'--commit', '${{ github.sha }}', '--commit', $repoCommit,
'--build-command', $env:INPUT_BUILD_COMMAND, '--build-command', $env:INPUT_BUILD_COMMAND,
'--guest-artifact-source', $env:INPUT_ARTIFACT_SOURCE, '--guest-artifact-source', $env:INPUT_ARTIFACT_SOURCE,
'--guest-os', $resolvedGuestOS, '--guest-os', $resolvedGuestOS,