Skip to content

Commit 6f9f7e1

Browse files
committed
feat: Add support for sourceTypeOverride and sourceLocationOverride
This commit introduces two new optional parameters: sourceTypeOverride: Allows overriding the source input type defined in the build project for the current build. Valid values include NO_SOURCE, CODECOMMIT, CODEPIPELINE, GITHUB, S3, BITBUCKET, and GITHUB_ENTERPRISE. sourceLocationOverride: Enables specifying a location that overrides the source location defined in the build project for the current build. These parameters provide flexibility in customizing the source settings for individual builds, without modifying the underlying build project configuration.
1 parent b31229d commit 6f9f7e1

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ The only required input is `project-name`.
7676
`sourceTypeOverride` and `sourceLocationOverride` to CodeBuild.
7777
1. **source-version-override** (optional) :
7878
The source version that overrides the `sourceVersion` provided to Codebuild.
79+
1. **source-type-override** (optional) :
80+
The source type that overrides the `sourceTypeOverride` provided to Codebuild.
81+
1. **source-location-override** (optional) :
82+
The source location that overrides the `sourceLocationOverride` provided to Codebuild.
7983
1. **env-vars-for-codebuild** (optional) :
8084
A comma-separated list of the names of environment variables
8185
that the action passes from GitHub Actions to CodeBuild.

action.yml

+6
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ inputs:
3737
source-version-override:
3838
description: 'The source version that overrides the sourceVersion provided to Codebuild.'
3939
required: false
40+
source-type-override:
41+
description: 'The source input type that overrides the source input defined in the build project for this build. Valid values include NO_SOURCE, CODECOMMIT, CODEPIPELINE, GITHUB, S3, BITBUCKET, and GITHUB_ENTERPRISE.'
42+
required: false
43+
source-location-override:
44+
description: 'The location that overrides the source location defined in the build project for this build.'
45+
required: false
4046
hide-cloudwatch-logs:
4147
description: 'Set to `true` to prevent the CloudWatch logs from streaming the output to GitHub'
4248
required: false

code-build.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,13 @@ function githubInputs() {
205205
: process.env[`GITHUB_SHA`]);
206206

207207
assert(sourceVersion, "No source version could be evaluated.");
208+
209+
const sourceTypeOverride =
210+
core.getInput("source-type-override", { required: false, }) || undefined;
211+
212+
const sourceLocationOverride =
213+
core.getInput("source-location-override", { required: false }) || undefined;
214+
208215
const buildspecOverride =
209216
core.getInput("buildspec-override", { required: false }) || undefined;
210217

@@ -282,6 +289,8 @@ function inputs2Parameters(inputs) {
282289
owner,
283290
repo,
284291
sourceVersion,
292+
sourceTypeOverride,
293+
sourceLocationOverride,
285294
buildspecOverride,
286295
computeTypeOverride,
287296
environmentTypeOverride,
@@ -296,8 +305,8 @@ function inputs2Parameters(inputs) {
296305
const sourceOverride = !disableSourceOverride
297306
? {
298307
sourceVersion: sourceVersion,
299-
sourceTypeOverride: "GITHUB",
300-
sourceLocationOverride: `https://github.com/${owner}/${repo}.git`,
308+
sourceTypeOverride: sourceTypeOverride || "GITHUB",
309+
sourceLocationOverride: sourceLocationOverride || `https://github.com/${owner}/${repo}.git`,
301310
}
302311
: {};
303312

0 commit comments

Comments
 (0)