FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
baseweb/scripts/sync-web-code.js at master · CodeFaceIO/baseweb · GitHub
CodeFaceIO
/
baseweb
Public
forked from
uber/baseweb
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
15
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
baseweb
/
scripts
/
sync-web-code.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
63 lines (51 loc) · 1.59 KB
Breadcrumbs
baseweb
/
scripts
/
sync-web-code.js
Copy path
File metadata and controls
63 lines (51 loc) · 1.59 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
Copyright (c) Uber Technologies, Inc.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
/* eslint-env node */
//
@flow
const
fetch
=
require
(
'node-fetch'
)
.
default
;
const
BUILDKITE_TASK_RUNNER_URL
=
'https://api.buildkite.com/v2/organizations/uber/pipelines/web-code-task-runner/builds'
;
function
expectEnvironmentVariable
(
name
)
{
if
(
!
process
.
env
[
name
]
)
{
throw
new
Error
(
`Missing environment variable:
${
name
}
`
)
;
}
return
process
.
env
[
name
]
;
}
async
function
createBuild
(
token
,
commitHash
)
{
const
body
=
{
branch
:
'main'
,
commit
:
'HEAD'
,
message
:
'[baseui-sync] Triggered from CI'
,
meta_data
:
{
task
:
'baseui-sync'
}
,
env
:
{
TASK
:
'baseui-sync'
,
TASK_ENV
:
`BASEUI_OPEN_SOURCE_COMMIT=
${
commitHash
}
`
,
PACKAGES
:
'src/common/@uber/baseui'
,
}
,
}
;
const
createBuildResponse
=
await
fetch
(
BUILDKITE_TASK_RUNNER_URL
,
{
method
:
'POST'
,
body
:
JSON
.
stringify
(
body
)
,
headers
:
{
Authorization
:
`Bearer
${
token
}
`
}
,
}
)
;
if
(
!
createBuildResponse
.
ok
)
{
throw
new
Error
(
`Failed to create build:
${
createBuildResponse
.
status
}
${
createBuildResponse
.
statusText
}
`
)
;
}
const
json
=
await
createBuildResponse
.
json
(
)
;
return
json
;
}
async
function
main
(
)
{
const
token
=
expectEnvironmentVariable
(
'BUILDKITE_API_TOKEN'
)
;
const
commitHash
=
expectEnvironmentVariable
(
'BUILDKITE_COMMIT'
)
;
const
build
=
await
createBuild
(
token
,
commitHash
)
;
console
.
log
(
`View sync build at
${
build
.
web_url
}
`
)
;
}
main
(
)
.
catch
(
(
err
)
=>
{
console
.
error
(
err
)
;
process
.
exit
(
1
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL