Skip to content

Commit 4ed4938

Browse files
authored
Merge pull request #1033 from crazy-max/git-context-fallback
buildx(build): simplify git context format fallback
2 parents c6393e7 + 512a30b commit 4ed4938

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/buildx/build.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,17 @@ export class Build {
7979
const baseURL = `${GitHub.serverURL}/${github.context.repo.owner}/${github.context.repo.repo}.git`;
8080
let format = opts?.format;
8181
if (!format) {
82-
const sendGitQueryAsInput = Util.parseBoolOrDefault(process.env.BUILDX_SEND_GIT_QUERY_AS_INPUT);
82+
format = 'fragment';
8383
if (attrs.length > 0) {
8484
format = 'query';
85-
} else if (sendGitQueryAsInput && (await this.buildx.versionSatisfies('>=0.29.0'))) {
86-
format = 'query';
87-
} else {
88-
format = 'fragment';
85+
} else if (Util.parseBoolOrDefault(process.env.BUILDX_SEND_GIT_QUERY_AS_INPUT)) {
86+
try {
87+
if (await this.buildx.versionSatisfies('>=0.29.0')) {
88+
format = 'query';
89+
}
90+
} catch {
91+
// keep fragment fallback when Buildx version cannot be determined.
92+
}
8993
}
9094
}
9195
if (format === 'query') {

0 commit comments

Comments
 (0)