-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
51 lines (44 loc) · 1.45 KB
/
index.ts
File metadata and controls
51 lines (44 loc) · 1.45 KB
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
import * as core from '@actions/core';
import run from './scripts/dependency-update';
try {
const wsDir: string = core.getInput('ws-dir') || process.env.WSDIR || './';
const branch: string = core.getInput('branch') || 'main';
const allow = core.getInput('allow').replace(/\s+/g, '').split(',');
const versionUpdatePolicy = core.getInput('version-update-policy') || '';
const packagePatterns = core.getInput('package-patterns') || '';
const componentPatterns = core.getInput('component-patterns') || '';
const envPatterns = core.getInput('env-patterns') || '';
const allowExternalDependencies =
allow.includes('external-dependencies') || allow.includes('all');
if (!allowExternalDependencies && versionUpdatePolicy) {
core.warning(
'External dependency updates are not allowed. "Version update policy" is ignored.'
);
}
const githubToken = process.env.GITHUB_TOKEN;
if (!githubToken) {
throw new Error('GitHub token not found');
}
const gitUserName = process.env.GIT_USER_NAME;
if (!gitUserName) {
throw new Error('Git user name not found');
}
const gitUserEmail = process.env.GIT_USER_EMAIL;
if (!gitUserEmail) {
throw new Error('Git user email token not found');
}
run(
branch,
githubToken,
gitUserName,
gitUserEmail,
wsDir,
allow,
versionUpdatePolicy,
packagePatterns,
componentPatterns,
envPatterns
);
} catch (error) {
core.setFailed((error as Error).message);
}