-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Expand file tree
/
Copy pathdeploy.js
More file actions
37 lines (32 loc) · 985 Bytes
/
deploy.js
File metadata and controls
37 lines (32 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* GHA Workflow helpers for deploys
*
*/
/**
* Checks what files were changed in a commit and adds a GH check
* corresponding with changes. This can be used by our deploy system to
* determine what Freight deploy we can use.
*/
export async function updateChangeType({github, context, fileChanges}) {
// Note that `fileChanges` bools and ints will get cast to strings
const {frontend_all: frontend, backend_all: backend} = fileChanges;
const frontendOnly = frontend === 'true' && backend === 'false';
const backendOnly = backend === 'true' && frontend === 'false';
const name = frontendOnly
? 'only frontend changes'
: backendOnly
? 'only backend changes'
: 'fullstack changes';
if (!name) {
return null;
}
const result = await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
name,
head_sha: context.sha,
status: 'completed',
conclusion: 'success',
});
return result;
}