Skip to content

Commit 24e5771

Browse files
authored
Merge pull request #142 from vitulrana/main
Disabled GITHUB Envs being passed to Codebuild
2 parents 2e69f61 + b20f3a4 commit 24e5771

File tree

5 files changed

+1343
-1299
lines changed

5 files changed

+1343
-1299
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ The only required input is `project-name`.
112112
1. **hide-cloudwatch-logs** (optional) :
113113
Set to `true` if you do not want CloudWatch Logs to be streamed to GitHub Action.
114114

115+
1. **disable-github-env-vars** (optional) :
116+
Set to `true` if you want do disable github environment variables in codebuild.
117+
115118
### Outputs
116119

117120
1. **aws-build-id** : The CodeBuild build ID of the build that the action ran.

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ inputs:
3434
hide-cloudwatch-logs:
3535
description: 'Set to `true` to prevent the CloudWatch logs from streaming the output to GitHub'
3636
required: false
37+
disable-github-env-vars:
38+
description: 'Set to `true` if you want do disable github environment variables in codebuild'
39+
required: false
3740
outputs:
3841
aws-build-id:
3942
description: 'The AWS CodeBuild Build ID for this build.'

code-build.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ function githubInputs() {
213213
const hideCloudWatchLogs =
214214
core.getInput("hide-cloudwatch-logs", { required: false }) === "true";
215215

216+
const disableGithubEnvVars =
217+
core.getInput("disable-github-env-vars", { required: false }) === "true";
218+
216219
return {
217220
projectName,
218221
owner,
@@ -227,6 +230,7 @@ function githubInputs() {
227230
updateBackOff,
228231
disableSourceOverride,
229232
hideCloudWatchLogs,
233+
disableGithubEnvVars,
230234
};
231235
}
232236

@@ -242,6 +246,7 @@ function inputs2Parameters(inputs) {
242246
imageOverride,
243247
envPassthrough = [],
244248
disableSourceOverride,
249+
disableGithubEnvVars,
245250
} = inputs;
246251

247252
const sourceOverride = !disableSourceOverride
@@ -254,7 +259,9 @@ function inputs2Parameters(inputs) {
254259

255260
const environmentVariablesOverride = Object.entries(process.env)
256261
.filter(
257-
([key]) => key.startsWith("GITHUB_") || envPassthrough.includes(key)
262+
([key]) =>
263+
(!disableGithubEnvVars && key.startsWith("GITHUB_")) ||
264+
envPassthrough.includes(key)
258265
)
259266
.map(([name, value]) => ({ name, value, type: "PLAINTEXT" }));
260267

0 commit comments

Comments
 (0)