Skip to content

Commit

Permalink
Merge pull request #1133 from crazy-max/gha-cache-to
Browse files Browse the repository at this point in the history
set repository and ghtoken attributes for gha cache type
  • Loading branch information
crazy-max authored Jul 15, 2024
2 parents 1a16264 + ef76d10 commit f23fb2a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
21 changes: 21 additions & 0 deletions __tests__/context.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,27 @@ ANOTHER_SECRET=ANOTHER_SECRET_ENV`]
'.'
]
],
[
34,
'0.14.1',
new Map<string, string>([
['context', '.'],
['load', 'false'],
['no-cache', 'false'],
['push', 'false'],
['pull', 'false'],
['cache-to', 'type=gha'],
['github-token', `abcd1234`],
]),
[
'build',
'--cache-to', 'type=gha,repository=docker/build-push-action,ghtoken=abcd1234',
'--iidfile', imageIDFilePath,
'--attest', `type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`,
'--metadata-file', metadataJson,
'.'
]
],
])(
'[%d] given %p with %p as inputs, returns %p',
async (num: number, buildxVersion: string, inputs: Map<string, string>, expected: Array<string>) => {
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ async function getBuildArgs(inputs: Inputs, context: string, toolkit: Toolkit):
args.push('--cache-from', cacheFrom);
});
await Util.asyncForEach(inputs['cache-to'], async cacheTo => {
args.push('--cache-to', cacheTo);
args.push('--cache-to', Build.resolveCacheToAttrs(cacheTo, inputs['github-token']));
});
if (inputs['cgroup-parent']) {
args.push('--cgroup-parent', inputs['cgroup-parent']);
Expand Down

0 comments on commit f23fb2a

Please sign in to comment.