Added environment variable support for GITHUB_TOKEN

This commit is contained in:
Corey Butler 2020-01-30 17:21:09 -06:00
parent e011fb10da
commit 5f67dd4d79

View File

@ -28,12 +28,14 @@ async function run() {
core.debug(` Detected version ${pkg.version}`)
if (!process.env.hasOwnProperty('INPUT_GITHUB_TOKEN') || process.env.INPUT_GITHUB_TOKEN.trim().length === 0) {
core.setFailed('Invalid or missing GITHUB_TOKEN.')
return
if (!process.env.hasOwnProperty('GITHUB_TOKEN')) {
core.setFailed('Invalid or missing GITHUB_TOKEN.')
return
}
}
// Check for existing tag
const git = new github.GitHub(process.env.INPUT_GITHUB_TOKEN)
const git = new github.GitHub(process.env.INPUT_GITHUB_TOKEN || process.env.GITHUB_TOKEN)
const owner = process.env.GITHUB_ACTOR
const repo = process.env.GITHUB_REPOSITORY.split('/').pop()