MCPcopy Create free account
hub / github.com/PRX/Infrastructure / startBuild

Function startBuild

ci/src/build-handler/index.mjs:78–102  ·  view source on GitHub ↗

* * @param {GitHubPullRequestWebhookPayload|GitHubPushWebhookPayload} event * @param {string} buildspec * @param {object} environmentVariables * @param {string} projectName * @param {object} extraEnvironmentVariables

(
  event,
  buildspec,
  environmentVariables,
  projectName,
  extraEnvironmentVariables,
)

Source from the content-addressed store, hash-verified

76 * @param {object} extraEnvironmentVariables
77 */
78async function startBuild(
79 event,
80 buildspec,
81 environmentVariables,
82 projectName,
83 extraEnvironmentVariables,
84) {
85 const environmentVariablesOverride = [
86 ...environmentVariables,
87 ...extraEnvironmentVariables,
88 ];
89
90 return codebuild.send(
91 new StartBuildCommand({
92 projectName,
93 sourceTypeOverride: 'GITHUB',
94 sourceLocationOverride: event.repository.clone_url,
95 sourceVersion: eventIsPullRequest(event)
96 ? `pr/${event.pull_request.number}`
97 : event.after,
98 buildspecOverride: buildspec,
99 environmentVariablesOverride,
100 }),
101 );
102}
103
104/**
105 * `startBuild` returns a Build object

Callers 1

triggerBuildFunction · 0.85

Calls 1

eventIsPullRequestFunction · 0.85

Tested by

no test coverage detected