diff --git a/lib/handlers/create.js b/lib/handlers/create.js index b241b8e..896dfe5 100644 --- a/lib/handlers/create.js +++ b/lib/handlers/create.js @@ -1,6 +1,6 @@ const zh = require('../zh-client'), resolveIssueNumbers = require('../resolve-issue-number'), - { INPROG_COLUMN } = process.env; + { INPUT_INPROG_COLUMN } = process.env; exports.branch = async function handleCreatedBranch (tools) { tools.log.info('Handling created branch...'); @@ -34,12 +34,12 @@ exports.branch = async function handleCreatedBranch (tools) { } // Move issue(s) to INPROG_COLUMN - if (INPROG_COLUMN) { + if (INPUT_INPROG_COLUMN) { try { tools.log.info(`Moving issue #${issueNo} to in progress...`); await zh.issues.moveIssueBetweenPipelines(payload.repository.id, issueNo, { - pipeline_id: INPROG_COLUMN, + pipeline_id: INPUT_INPROG_COLUMN, position: 'top' }); diff --git a/lib/handlers/pull_request.js b/lib/handlers/pull_request.js index 91681b7..c8c4d4c 100644 --- a/lib/handlers/pull_request.js +++ b/lib/handlers/pull_request.js @@ -1,8 +1,8 @@ const zh = require('../zh-client'), resolveIssueNumbers = require('../resolve-issue-number'), { - PR_COLUMN, - REVIEW_COLUMN + INPUT_PR_COLUMN, + INPUT_REVIEW_COLUMN } = process.env; exports.opened = async function handleOpenedPR (tools) { @@ -12,11 +12,11 @@ exports.opened = async function handleOpenedPR (tools) { { payload } = tools.context; // Move PR to PR issue column specified by ENV var - if (PR_COLUMN) { + if (INPUT_PR_COLUMN) { tools.log.info('ZH :: Moving opened PR...'); try { await zh.issues.moveIssueBetweenPipelines(payload.repository.id, payload.number, { - pipeline_id: PR_COLUMN, + pipeline_id: INPUT_PR_COLUMN, position: 'top' }); } catch (e) { @@ -27,7 +27,7 @@ exports.opened = async function handleOpenedPR (tools) { } // Move PR closes to REVIEW_COLUMN - if (REVIEW_COLUMN) { + if (INPUT_REVIEW_COLUMN) { let issueNumbers = resolveIssueNumbers(payload.pull_request.head.ref, payload.pull_request.body); for (let i = 0; i < issueNumbers.length; i++) { @@ -35,7 +35,7 @@ exports.opened = async function handleOpenedPR (tools) { try { await zh.issues.moveIssueBetweenPipelines(payload.repository.id, issueNo, { - pipeline_id: REVIEW_COLUMN, + pipeline_id: INPUT_REVIEW_COLUMN, position: 'top' }); } catch (e) { diff --git a/lib/zh-client.js b/lib/zh-client.js index 0a53894..4898e60 100644 --- a/lib/zh-client.js +++ b/lib/zh-client.js @@ -1,9 +1,9 @@ const ZenhubAPI = require('zenhub-client'), { promisifyAll } = require('bluebird'), - { ZENHUB_API_KEY } = process.env; + { INPUT_ZENHUB_API_KEY } = process.env; -if (!ZENHUB_API_KEY) { +if (!INPUT_ZENHUB_API_KEY) { throw new Error('"ZENHUB_API_KEY" was not found, please set it in environment secrets.'); } -module.exports = new ZenhubAPI(ZENHUB_API_KEY); +module.exports = new ZenhubAPI(INPUT_ZENHUB_API_KEY);