Merge pull request #285 from crazy-max/revert-git-auth-token

Revert "set GIT_AUTH_TOKEN secret if Git context used"
This commit is contained in:
CrazyMax
2025-01-14 14:52:03 +01:00
committed by GitHub
5 changed files with 3 additions and 17 deletions

View File

@ -729,7 +729,6 @@ jobs:
name: Build
uses: ./
with:
source: .
files: |
./test/config.hcl
allow: network.host

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -68,10 +68,6 @@ export function sanitizeInputs(inputs: Inputs) {
return res;
}
export function getGitAuthToken(inputs: Inputs): string {
return process.env.BUILDX_BAKE_GIT_AUTH_TOKEN ?? inputs['github-token'];
}
export async function getArgs(inputs: Inputs, definition: BakeDefinition, toolkit: Toolkit): Promise<Array<string>> {
// prettier-ignore
return [
@ -101,15 +97,6 @@ async function getBakeArgs(inputs: Inputs, definition: BakeDefinition, toolkit:
await Util.asyncForEach(inputs.set, async set => {
args.push('--set', set);
});
if (await toolkit.buildx.versionSatisfies('<0.20.0')) {
// For buildx versions < 0.20.0, we need to set GIT_AUTH_TOKEN secret as it
// doesn't infer BUILDX_BAKE_GIT_AUTH_TOKEN environment variable for build
// request: https://github.com/docker/buildx/pull/2905
const gitAuthToken = getGitAuthToken(inputs);
if (gitAuthToken && !Bake.hasGitAuthTokenSecret(definition) && inputs.source.startsWith(Context.gitContext())) {
args.push('--set', `*.secrets=${Build.resolveSecretString(`GIT_AUTH_TOKEN=${gitAuthToken}`)}`);
}
}
if (await toolkit.buildx.versionSatisfies('>=0.6.0')) {
args.push('--metadata-file', toolkit.buildxBake.getMetadataFilePath());
}

View File

@ -30,7 +30,7 @@ actionsToolkit.run(
stateHelper.setInputs(inputs);
const toolkit = new Toolkit();
const gitAuthToken = context.getGitAuthToken(inputs);
const gitAuthToken = process.env.BUILDX_BAKE_GIT_AUTH_TOKEN ?? inputs['github-token'];
await core.group(`GitHub Actions runtime token ACs`, async () => {
try {