feat(ci): repo-branch/repo-commit inputs for cross-repo builds
github.ref_name/github.sha refer to the workflow's own repo. When
repo-url points elsewhere (build-nsInnoUnp builds
nsis-plugin-nsinnounp) the workflow's branch does not exist there
("Remote branch ... not found in upstream origin"). New inputs:
- repo-branch: target branch (default: github.ref_name)
- repo-commit: target commit (default: github.sha only if repo-url
not overridden; cross-repo => empty = branch tip, no pin)
build-nsInnoUnp.yml sets repo-branch: main.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ jobs:
|
|||||||
# host-side clone + zip transfer transport.
|
# host-side clone + zip transfer transport.
|
||||||
use-git-clone: 'false'
|
use-git-clone: 'false'
|
||||||
repo-url: 'ssh://gitea-ci/Simone/nsis-plugin-nsinnounp.git'
|
repo-url: 'ssh://gitea-ci/Simone/nsis-plugin-nsinnounp.git'
|
||||||
|
# Cross-repo build: github.ref_name is this repo's branch, not
|
||||||
|
# nsis-plugin-nsinnounp's. Pin the target repo's branch.
|
||||||
|
repo-branch: 'main'
|
||||||
# Suffix disambiguates artifact dirs: F:\CI\Artifacts\{run_id}-{attempt}-windows
|
# Suffix disambiguates artifact dirs: F:\CI\Artifacts\{run_id}-{attempt}-windows
|
||||||
job-id-suffix: '${{ matrix.target }}'
|
job-id-suffix: '${{ matrix.target }}'
|
||||||
artifact-name: 'nsis-plugin-nsinnounp-${{ matrix.target }}-${{ github.ref_name }}'
|
artifact-name: 'nsis-plugin-nsinnounp-${{ matrix.target }}-${{ github.ref_name }}'
|
||||||
|
|||||||
Reference in New Issue
Block a user