Skip to content

Commit 2da5a1f

Browse files
committed
build: use getMultilineInput from core toolkit
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
1 parent 82581c8 commit 2da5a1f

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,7 @@ jobs:
8686
INPUT_META-IMAGE: ${{ inputs.meta-image }}
8787
with:
8888
script: |
89-
function getInputList(name) {
90-
return core.getInput(name) ? core.getInput(name).split(/[\r?\n,]+/).filter(x => x !== '') : [];
91-
}
92-
if (getInputList('meta-image').length > 1) {
89+
if (core.getMultilineInput('meta-image').length > 1) {
9390
throw new Error('Only one meta-image is allowed');
9491
}
9592
-
@@ -134,11 +131,8 @@ jobs:
134131
INPUT_TAGS: ${{ steps.meta.outputs.tags }}
135132
with:
136133
script: |
137-
function getInputList(name) {
138-
return core.getInput(name) ? core.getInput(name).split(/[\r?\n,]+/).filter(x => x !== '') : [];
139-
}
140134
await core.group(`Get attestations digest`, async () => {
141-
await exec.getExecOutput('docker', ['buildx', 'imagetools', 'inspect', getInputList('tags')[0], '--format', '{{json .Manifest}}'], {
135+
await exec.getExecOutput('docker', ['buildx', 'imagetools', 'inspect', core.getMultilineInput('tags')[0], '--format', '{{json .Manifest}}'], {
142136
ignoreReturnCode: true,
143137
silent: true
144138
}).then(res => {
@@ -164,11 +158,8 @@ jobs:
164158
INPUT_DIGESTS: ${{ steps.attest.outputs.digests }}
165159
with:
166160
script: |
167-
function getInputList(name) {
168-
return core.getInput(name) ? core.getInput(name).split(/[\r?\n,]+/).filter(x => x !== '') : [];
169-
}
170-
const tags = getInputList('tags');
171-
const digests = getInputList('digests');
161+
const tags = core.getMultilineInput('tags');
162+
const digests = core.getMultilineInput('digests');
172163
const images = [];
173164
for (const tag of tags) {
174165
for (const digest of digests) {
@@ -191,12 +182,8 @@ jobs:
191182
INPUT_DIGESTS: ${{ steps.attest.outputs.digests }}
192183
with:
193184
script: |
194-
function getInputList(name) {
195-
return core.getInput(name) ? core.getInput(name).split(/[\r?\n,]+/).filter(x => x !== '') : [];
196-
}
197-
const tags = getInputList('tags');
198-
const digests = getInputList('digests');
199-
const images = [];
185+
const tags = core.getMultilineInput('tags');
186+
const digests = core.getMultilineInput('digests');
200187
for (const tag of tags) {
201188
for (const digest of digests) {
202189
await core.group(`Verifying ${tag}@${digest}`, async () => {
@@ -219,12 +206,8 @@ jobs:
219206
INPUT_IMAGE-DIGEST: ${{ steps.build.outputs.digest }}
220207
with:
221208
script: |
222-
function getInputList(name) {
223-
return core.getInput(name) ? core.getInput(name).split(/[\r?\n,]+/).filter(x => x !== '') : [];
224-
}
225-
226209
let createArgs = ['buildx', 'imagetools', 'create'];
227-
for (const tag of getInputList('tags')) {
210+
for (const tag of core.getMultilineInput('tags')) {
228211
createArgs.push('-t', tag);
229212
}
230213
createArgs.push(core.getInput('image-digest'));

0 commit comments

Comments
 (0)