diff --git a/lib/main.js b/lib/main.js index b08b9f1..2834df5 100644 --- a/lib/main.js +++ b/lib/main.js @@ -6,8 +6,6 @@ const os = require('os') async function run() { try { - const { repo } = github.context - core.debug( ` Available environment variables:\n -> ${Object.keys(process.env) .map(i => i + ' :: ' + process.env[i]) @@ -23,6 +21,13 @@ async function run() { core.debug(` Working Directory: ${process.env.GITHUB_WORKSPACE}:\n${dir}`) + if (!process.env.hasOwnProperty('INPUT_GITHUB_TOKEN') || process.env.INPUT_GITHUB_TOKEN.trim().length === 0) { + if (!process.env.hasOwnProperty('GITHUB_TOKEN')) { + core.setFailed('Invalid or missing GITHUB_TOKEN.') + return + } + } + const pkg_root = core.getInput('package_root', { required: false }) const pkgfile = path.join(process.env.GITHUB_WORKSPACE, pkg_root, 'package.json') if (!fs.existsSync(pkgfile)) { @@ -63,13 +68,6 @@ async function run() { // core.debug(` Detected version ${version}`) - if (!process.env.hasOwnProperty('INPUT_GITHUB_TOKEN') || process.env.INPUT_GITHUB_TOKEN.trim().length === 0) { - 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 || process.env.GITHUB_TOKEN) const owner = process.env.GITHUB_ACTOR