generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
semaphore.ts
36 lines (34 loc) · 896 Bytes
/
semaphore.ts
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
const axios = require('axios')
import * as core from '@actions/core'
// TEMP: Will be implemented via action inputs
const semaphoreAPI = core.getInput('semaphoreAPI')
const semaphoreAPIKey = core.getInput('semaphoreAPIKey')
export async function getLocks(component: string): Promise<any> {
return axios.get(
semaphoreAPI +
`/api/products/5f7427d977b4b64aeabad92d/components/${component}/locks`,
{
headers: {
Authorization: semaphoreAPIKey
}
}
)
}
export async function setLock(component: string): Promise<any> {
return axios.post(
semaphoreAPI +
`/api/products/5f7427d977b4b64aeabad92d/components/${component}/locks`,
{
lock: {
created_by: 'github_action',
purpose: 'manual deployment lock',
expires_at: null
}
},
{
headers: {
Authorization: semaphoreAPIKey
}
}
)
}