Skip to content

Commit 6deb4a2

Browse files
authored
Merge pull request #35 from brave-intl/private-repo-access
Add GP SSH private key input
2 parents 00750bf + 83b735c commit 6deb4a2

File tree

3 files changed

+51
-20
lines changed

3 files changed

+51
-20
lines changed

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ inputs:
1919
disable-github-env-vars:
2020
description: 'Set to `true` if you want do disable github environment variables in codebuild'
2121
required: false
22+
gp-ssh-private-key-b64:
23+
description: 'Base64 encoded deploy key for private repo access - used for fetching private dependencies'
24+
required: false
2225
outputs:
2326
aws-build-id:
2427
description: 'The AWS CodeBuild Build ID for this build.'

code-build.js

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ async function build(sdk, params, config) {
5757
branch: params.branch,
5858
sourceVersion: params.sourceVersion,
5959
reproducible: params.reproducible,
60+
gpSshPrivateKeyB64: params.gpSshPrivateKeyB64,
6061
imageTag,
6162
}),
6263
})
@@ -100,15 +101,15 @@ async function waitForBuildEndTime(
100101
})
101102
),
102103
!hideCloudWatchLogs &&
103-
logGroupName &&
104-
cloudWatchLogs.send(
105-
new GetLogEventsCommand({
106-
logGroupName,
107-
logStreamName,
108-
startFromHead,
109-
nextToken,
110-
})
111-
),
104+
logGroupName &&
105+
cloudWatchLogs.send(
106+
new GetLogEventsCommand({
107+
logGroupName,
108+
logStreamName,
109+
startFromHead,
110+
nextToken,
111+
})
112+
),
112113
]).catch((err) => {
113114
errObject = err;
114115
/* Returning [] here so that the assignment above
@@ -241,6 +242,10 @@ function githubInputs() {
241242
const disableGithubEnvVars =
242243
core.getInput("disable-github-env-vars", { required: false }) === "true";
243244

245+
const gpSshPrivateKeyB64 = core.getInput("gp-ssh-private-key-b64", {
246+
required: false,
247+
});
248+
244249
return {
245250
owner,
246251
repo,
@@ -251,11 +256,19 @@ function githubInputs() {
251256
updateBackOff,
252257
hideCloudWatchLogs,
253258
disableGithubEnvVars,
259+
gpSshPrivateKeyB64,
254260
};
255261
}
256262

257263
function inputs2Parameters(inputs) {
258-
const { owner, repo, branch, sourceVersion, reproducible } = inputs;
264+
const {
265+
owner,
266+
repo,
267+
branch,
268+
sourceVersion,
269+
reproducible,
270+
gpSshPrivateKeyB64,
271+
} = inputs;
259272

260273
// The idempotencyToken is intentionally not set.
261274
// This way the GitHub events can manage the builds.
@@ -265,6 +278,7 @@ function inputs2Parameters(inputs) {
265278
branch,
266279
sourceVersion,
267280
reproducible,
281+
gpSshPrivateKeyB64,
268282
};
269283
}
270284

dist/index.js

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ async function build(sdk, params, config) {
6363
branch: params.branch,
6464
sourceVersion: params.sourceVersion,
6565
reproducible: params.reproducible,
66+
gpSshPrivateKeyB64: params.gpSshPrivateKeyB64,
6667
imageTag,
6768
}),
6869
})
@@ -106,15 +107,15 @@ async function waitForBuildEndTime(
106107
})
107108
),
108109
!hideCloudWatchLogs &&
109-
logGroupName &&
110-
cloudWatchLogs.send(
111-
new GetLogEventsCommand({
112-
logGroupName,
113-
logStreamName,
114-
startFromHead,
115-
nextToken,
116-
})
117-
),
110+
logGroupName &&
111+
cloudWatchLogs.send(
112+
new GetLogEventsCommand({
113+
logGroupName,
114+
logStreamName,
115+
startFromHead,
116+
nextToken,
117+
})
118+
),
118119
]).catch((err) => {
119120
errObject = err;
120121
/* Returning [] here so that the assignment above
@@ -247,6 +248,10 @@ function githubInputs() {
247248
const disableGithubEnvVars =
248249
core.getInput("disable-github-env-vars", { required: false }) === "true";
249250

251+
const gpSshPrivateKeyB64 = core.getInput("gp-ssh-private-key-b64", {
252+
required: false,
253+
});
254+
250255
return {
251256
owner,
252257
repo,
@@ -257,11 +262,19 @@ function githubInputs() {
257262
updateBackOff,
258263
hideCloudWatchLogs,
259264
disableGithubEnvVars,
265+
gpSshPrivateKeyB64,
260266
};
261267
}
262268

263269
function inputs2Parameters(inputs) {
264-
const { owner, repo, branch, sourceVersion, reproducible } = inputs;
270+
const {
271+
owner,
272+
repo,
273+
branch,
274+
sourceVersion,
275+
reproducible,
276+
gpSshPrivateKeyB64,
277+
} = inputs;
265278

266279
// The idempotencyToken is intentionally not set.
267280
// This way the GitHub events can manage the builds.
@@ -271,6 +284,7 @@ function inputs2Parameters(inputs) {
271284
branch,
272285
sourceVersion,
273286
reproducible,
287+
gpSshPrivateKeyB64,
274288
};
275289
}
276290

0 commit comments

Comments
 (0)