buildx(build): simplify git context format fallback

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2026-03-24 14:52:31 +01:00
parent c6393e7db0
commit 512a30b8f2

View File

@@ -79,13 +79,17 @@ export class Build {
const baseURL = `${GitHub.serverURL}/${github.context.repo.owner}/${github.context.repo.repo}.git`;
let format = opts?.format;
if (!format) {
const sendGitQueryAsInput = Util.parseBoolOrDefault(process.env.BUILDX_SEND_GIT_QUERY_AS_INPUT);
format = 'fragment';
if (attrs.length > 0) {
format = 'query';
} else if (sendGitQueryAsInput && (await this.buildx.versionSatisfies('>=0.29.0'))) {
format = 'query';
} else {
format = 'fragment';
} else if (Util.parseBoolOrDefault(process.env.BUILDX_SEND_GIT_QUERY_AS_INPUT)) {
try {
if (await this.buildx.versionSatisfies('>=0.29.0')) {
format = 'query';
}
} catch {
// keep fragment fallback when Buildx version cannot be determined.
}
}
}
if (format === 'query') {