-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.ts
54 lines (49 loc) · 1.26 KB
/
index.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import * as core from "@actions/core";
import { createClient, addOrigin } from "@resideo/action-core-auth0";
import { interpolate } from "@resideo/action-core-interpolate-config";
interface Args {
domain: string;
apiClientId: string;
apiClientSecret: string;
clientId: string;
origin: string;
callbackUrl?: string;
logoutUrl?: string;
}
async function main({
domain,
apiClientId,
apiClientSecret,
clientId,
origin,
callbackUrl,
logoutUrl,
}: Args) {
try {
const auth0 = createClient({
domain,
clientId: apiClientId,
clientSecret: apiClientSecret,
});
await addOrigin(auth0, {
clientId,
origin: interpolate(origin),
callbackUrl: interpolate(callbackUrl || origin),
logoutUrl: interpolate(logoutUrl || origin),
});
core.info(`Origin "${origin}" added to auth0 client "${clientId}"`);
} catch (error) {
if (error instanceof Error) {
core.setFailed(error.message);
}
}
}
main({
domain: core.getInput("domain"),
apiClientId: core.getInput("apiClientId"),
apiClientSecret: core.getInput("apiClientSecret"),
clientId: core.getInput("clientId"),
origin: core.getInput("origin"),
callbackUrl: core.getInput("callbackUrl"),
logoutUrl: core.getInput("logoutUrl"),
});