Update to new INPUT_ syntax

This commit is contained in:
Andrea Maria Piana 2020-11-30 10:22:46 +01:00
parent 0e172d60e0
commit d49b0468b4
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
3 changed files with 12 additions and 12 deletions

View File

@ -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'
});

View File

@ -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) {

View File

@ -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);