generated from actions/javascript-action
-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.js
45 lines (40 loc) · 1.13 KB
/
index.js
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
const core = require('@actions/core');
const exec = require('@actions/exec');
const local_file_name = __dirname + '/elisp-check.el';
async function main() {
try {
// Get inputs
const check = core.getInput('check');
const file = core.getInput('file');
const ignore = getBooleanInput('ignore_warnings')
const as_errors = getBooleanInput('warnings_as_errors')
// Execute Emacs checks
await exec.exec(
'emacs',
[
'--no-site-file',
'--batch',
'--eval', '(setq debug-on-error t)',
'--load', local_file_name,
'--eval', `(setq elisp-check-ignore-warnings ${ignore})`,
'--eval', `(setq elisp-check-warnings-as-errors ${as_errors})`,
'--eval', `(elisp-check-run "${check}" "${file}" t)`
]
);
}
catch (error) {
process.exitCode = 1
}
}
// Get a Boolean input as its Emacs Lisp equivalent
function getBooleanInput(name) {
let input = core.getInput(name);
if (input === 'true') {
return 't';
} else if (input === 'false') {
return 'nil';
} else {
throw Error(`Option '${name}' could not be interpreted as a Boolean`);
}
}
main();