Skip to content

Commit 7992656

Browse files
authored
Merge branch 'main' into main
2 parents 620558a + f9d5a15 commit 7992656

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ The only required input is `project-name`.
7272
1. **disable-source-override** (optional) :
7373
Set to `true` if you want to disable providing `sourceVersion`,
7474
`sourceTypeOverride` and `sourceLocationOverride` to CodeBuild.
75+
1. **source-version-override** (optional) :
76+
The source version that overrides the `sourceVersion` provided to Codebuild.
7577
1. **env-vars-for-codebuild** (optional) :
7678
A comma-separated list of the names of environment variables
7779
that the action passes from GitHub Actions to CodeBuild.

action.yml

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ inputs:
3434
disable-source-override:
3535
description: 'Set to `true` if you want do disable source repo override'
3636
required: false
37+
source-version-override:
38+
description: 'The source version that overrides the sourceVersion provided to Codebuild.'
39+
required: false
3740
hide-cloudwatch-logs:
3841
description: 'Set to `true` to prevent the CloudWatch logs from streaming the output to GitHub'
3942
required: false

code-build.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,10 @@ function githubInputs() {
176176
// the GITHUB_SHA value is NOT the correct value.
177177
// See: https://github.com/aws-actions/aws-codebuild-run-build/issues/36
178178
const sourceVersion =
179-
process.env[`GITHUB_EVENT_NAME`] === "pull_request"
179+
core.getInput("source-version-override", { required: false }) ||
180+
(process.env[`GITHUB_EVENT_NAME`] === "pull_request"
180181
? (((payload || {}).pull_request || {}).head || {}).sha
181-
: process.env[`GITHUB_SHA`];
182+
: process.env[`GITHUB_SHA`]);
182183

183184
assert(sourceVersion, "No source version could be evaluated.");
184185
const buildspecOverride =

dist/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,10 @@ function githubInputs() {
182182
// the GITHUB_SHA value is NOT the correct value.
183183
// See: https://github.com/aws-actions/aws-codebuild-run-build/issues/36
184184
const sourceVersion =
185-
process.env[`GITHUB_EVENT_NAME`] === "pull_request"
185+
core.getInput("source-version-override", { required: false }) ||
186+
(process.env[`GITHUB_EVENT_NAME`] === "pull_request"
186187
? (((payload || {}).pull_request || {}).head || {}).sha
187-
: process.env[`GITHUB_SHA`];
188+
: process.env[`GITHUB_SHA`]);
188189

189190
assert(sourceVersion, "No source version could be evaluated.");
190191
const buildspecOverride =

0 commit comments

Comments
 (0)