-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (29 loc) · 754 Bytes
/
index.js
File metadata and controls
35 lines (29 loc) · 754 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
const checkHttpStatus = require('check-http-status');
const core = require('@actions/core');
try {
const skip200 = core.getInput('skip200');
const sitemapUrl = core.getInput('sitemap');
const urlsList = core.getInput('urls');
var httpConfig = {
'options': {
'headers': {
'Accept': 'text/html',
},
},
};
if (!sitemapUrl && !urlsList) {
core.setFailed('Either sitemap or urls is required.');
process.exit();
}
if (sitemapUrl) {
httpConfig['sitemap'] = JSON.parse(sitemapUrl);
} else if (urlsList) {
httpConfig['urls'] = JSON.parse(urlsList);
}
if (skip200) {
httpConfig['skip200'] = skip200;
}
checkHttpStatus(httpConfig);
} catch (error) {
core.setFailed(error.message);
}