Last active
March 15, 2019 05:44
-
-
Save romanlab/162435796e72983021bc4cb78bd58a77 to your computer and use it in GitHub Desktop.
basic node js script for github actions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const program = require('commander') | |
const fs = require('fs') | |
async function doSomething(arg) { return arg } | |
async function main() { | |
const event = JSON.parse(fs.readFileSync('/github/workflow/event.json', 'utf8')) | |
const firstArg = program.firstArg | |
const result = await doSometing(firstArg) | |
return result | |
} | |
if (require.main === module) { | |
program | |
.option('-f, --firstArg <argParam>', 'The list of valid licenses') | |
.parse(process.argv) | |
main() | |
.then(res => { | |
console.log({ res }) | |
process.exitCode = 0 | |
}) | |
.catch(err => { | |
console.log({ err }) | |
process.exitCode = 1 | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment