Skip to content

Commit f23fb2a

Browse files
authored
Merge pull request #1133 from crazy-max/gha-cache-to
set repository and ghtoken attributes for gha cache type
2 parents 1a16264 + ef76d10 commit f23fb2a

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

__tests__/context.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,27 @@ ANOTHER_SECRET=ANOTHER_SECRET_ENV`]
799799
'.'
800800
]
801801
],
802+
[
803+
34,
804+
'0.14.1',
805+
new Map<string, string>([
806+
['context', '.'],
807+
['load', 'false'],
808+
['no-cache', 'false'],
809+
['push', 'false'],
810+
['pull', 'false'],
811+
['cache-to', 'type=gha'],
812+
['github-token', `abcd1234`],
813+
]),
814+
[
815+
'build',
816+
'--cache-to', 'type=gha,repository=docker/build-push-action,ghtoken=abcd1234',
817+
'--iidfile', imageIDFilePath,
818+
'--attest', `type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`,
819+
'--metadata-file', metadataJson,
820+
'.'
821+
]
822+
],
802823
])(
803824
'[%d] given %p with %p as inputs, returns %p',
804825
async (num: number, buildxVersion: string, inputs: Map<string, string>, expected: Array<string>) => {

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ async function getBuildArgs(inputs: Inputs, context: string, toolkit: Toolkit):
139139
args.push('--cache-from', cacheFrom);
140140
});
141141
await Util.asyncForEach(inputs['cache-to'], async cacheTo => {
142-
args.push('--cache-to', cacheTo);
142+
args.push('--cache-to', Build.resolveCacheToAttrs(cacheTo, inputs['github-token']));
143143
});
144144
if (inputs['cgroup-parent']) {
145145
args.push('--cgroup-parent', inputs['cgroup-parent']);

0 commit comments

Comments
 (0)