From a19e3a7499487c153b1b44ae743cd0f33126819b Mon Sep 17 00:00:00 2001 From: Rob Anderson Date: Mon, 7 Aug 2023 13:18:52 -0400 Subject: [PATCH] fix reapplying label to issue (#65) --- app.js | 2 +- test.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 9164b99..956c99a 100644 --- a/app.js +++ b/app.js @@ -167,7 +167,7 @@ module.exports = (app) => { await context.octokit.rest.issues.addLabels({ owner: context.payload.repository.owner.login, repo: context.payload.repository.name, - issue_number: context.payload.pull_request.number, + issue_number: context.payload.issue.number, labels: [emergencyLabel] }).then(response => { console.log(`${emergencyLabel} label reapplied to PR: ${context.payload.issue.html_url}`); diff --git a/test.js b/test.js index 3205eb5..9434cd9 100644 --- a/test.js +++ b/test.js @@ -69,8 +69,6 @@ const payloadIssueUnlabeled = { issue: { url: "https://api.github.com/repos/robandpdx/superbigmono/issues/1", html_url: "https://github.com/robandpdx/superbigmono/pull/1", - }, - pull_request: { number: 1, }, repository: { @@ -549,7 +547,7 @@ test("recieves pull_request.unlabeled event, fail to reapply emergency label", a }); // This test will not reapply the emergency label to a PR -test("recieves pull_request.unlabeled event, dont't emergency label", async function () { +test("recieves pull_request.unlabeled event, don't emergency label", async function () { delete process.env.EMERGENCY_LABEL_PERMANENT; process.env.EMERGENCY_LABEL_PERMANENT = 'false'; await probot.receive(payloadUnlabeled);