generated from actions/javascript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
26 lines (21 loc) · 785 Bytes
/
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
const core = require('@actions/core');
const toggleProtection = require('./toggle-protection');
// most @actions toolkit packages have async methods
async function run() {
try {
// get inputs
const owner = core.getInput('owner');
const repo = core.getInput('repo');
const branch = core.getInput('branch');
const GITHUB_TOKEN = core.getInput('GITHUB_TOKEN');
const on = core.getInput('on');
const off = core.getInput('off');
core.debug('Input:', owner, repo, branch, GITHUB_TOKEN, on, off);
const output = await toggleProtection({ owner, repo, branch, GITHUB_TOKEN, on, off });
core.debug('Output', output);
core.setOutput('on', output.on ? output.on : output.nice);
} catch (error) {
core.setFailed(error.message);
}
}
run();