Skip to content

Commit 620558a

Browse files
committed
add artifacts-type-override to action.yml to specify the artifact type override
1 parent fd063b3 commit 620558a

File tree

4 files changed

+30
-8
lines changed

4 files changed

+30
-8
lines changed

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ inputs:
4040
disable-github-env-vars:
4141
description: 'Set to `true` if you want do disable github environment variables in codebuild'
4242
required: false
43+
artifacts-type-override:
44+
description: 'The type of build output artifact'
45+
required: false
4346
outputs:
4447
aws-build-id:
4548
description: 'The AWS CodeBuild Build ID for this build.'

code-build.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ function githubInputs() {
222222
const disableGithubEnvVars =
223223
core.getInput("disable-github-env-vars", { required: false }) === "true";
224224

225+
const artifactsTypeOverride =
226+
core.getInput("artifacts-type-override", { required: false }) || undefined;
227+
225228
return {
226229
projectName,
227230
owner,
@@ -238,6 +241,7 @@ function githubInputs() {
238241
disableSourceOverride,
239242
hideCloudWatchLogs,
240243
disableGithubEnvVars,
244+
artifactsTypeOverride,
241245
};
242246
}
243247

@@ -255,6 +259,7 @@ function inputs2Parameters(inputs) {
255259
envPassthrough = [],
256260
disableSourceOverride,
257261
disableGithubEnvVars,
262+
artifactsTypeOverride,
258263
} = inputs;
259264

260265
const sourceOverride = !disableSourceOverride
@@ -265,7 +270,13 @@ function inputs2Parameters(inputs) {
265270
}
266271
: {};
267272

268-
const artifactsOverride = { type: "NO_ARTIFACTS" };
273+
const artifactsOverride = artifactsTypeOverride
274+
? {
275+
artifactsOverride: {
276+
type: artifactsTypeOverride,
277+
},
278+
}
279+
: {};
269280

270281
const environmentVariablesOverride = Object.entries(process.env)
271282
.filter(
@@ -281,7 +292,7 @@ function inputs2Parameters(inputs) {
281292
projectName,
282293
...sourceOverride,
283294
buildspecOverride,
284-
artifactsOverride,
295+
...artifactsOverride,
285296
computeTypeOverride,
286297
environmentTypeOverride,
287298
imageOverride,

dist/index.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ function githubInputs() {
228228
const disableGithubEnvVars =
229229
core.getInput("disable-github-env-vars", { required: false }) === "true";
230230

231+
const artifactsTypeOverride =
232+
core.getInput("artifacts-type-override", { required: false }) || undefined;
233+
231234
return {
232235
projectName,
233236
owner,
@@ -244,6 +247,7 @@ function githubInputs() {
244247
disableSourceOverride,
245248
hideCloudWatchLogs,
246249
disableGithubEnvVars,
250+
artifactsTypeOverride,
247251
};
248252
}
249253

@@ -261,6 +265,7 @@ function inputs2Parameters(inputs) {
261265
envPassthrough = [],
262266
disableSourceOverride,
263267
disableGithubEnvVars,
268+
artifactsTypeOverride,
264269
} = inputs;
265270

266271
const sourceOverride = !disableSourceOverride
@@ -271,7 +276,13 @@ function inputs2Parameters(inputs) {
271276
}
272277
: {};
273278

274-
const artifactsOverride = { type: "NO_ARTIFACTS" };
279+
const artifactsOverride = artifactsTypeOverride
280+
? {
281+
artifactsOverride: {
282+
type: artifactsTypeOverride,
283+
},
284+
}
285+
: {};
275286

276287
const environmentVariablesOverride = Object.entries(process.env)
277288
.filter(
@@ -287,7 +298,7 @@ function inputs2Parameters(inputs) {
287298
projectName,
288299
...sourceOverride,
289300
buildspecOverride,
290-
artifactsOverride,
301+
...artifactsOverride,
291302
computeTypeOverride,
292303
environmentTypeOverride,
293304
imageOverride,

test/code-build-test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,6 @@ describe("inputs2Parameters", () => {
244244
expect(test)
245245
.to.haveOwnProperty("sourceLocationOverride")
246246
.and.to.equal(`https://github.com/owner/repo.git`);
247-
expect(test)
248-
.to.haveOwnProperty("artifactsOverride")
249-
.that.has.property("type")
250-
.that.equals("NO_ARTIFACTS");
251247
expect(test)
252248
.to.haveOwnProperty("buildspecOverride")
253249
.and.to.equal(undefined);
@@ -300,6 +296,7 @@ describe("inputs2Parameters", () => {
300296
imageOverride:
301297
"111122223333.dkr.ecr.us-west-2.amazonaws.com/codebuild-docker-repo",
302298
imagePullCredentialsTypeOverride: "CODEBUILD",
299+
artifactsTypeOverride: "NO_ARTIFACTS",
303300
});
304301
expect(test).to.haveOwnProperty("projectName").and.to.equal(projectName);
305302
expect(test).to.haveOwnProperty("sourceVersion").and.to.equal(sha);

0 commit comments

Comments
 (0)