From a4e1921a4542593d0b5ead2dc2c72176280900ff Mon Sep 17 00:00:00 2001 From: Shiqi Yang Date: Mon, 6 Jul 2020 12:59:47 -0700 Subject: [PATCH] 1.1.0 release --- dist/index.js | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/dist/index.js b/dist/index.js index 18fb925..9ec6a39 100644 --- a/dist/index.js +++ b/dist/index.js @@ -31470,35 +31470,29 @@ function runPushAlert(args) { if (!args.slackEndpoint) { throw new Error('Slack notification endpoint undefined'); } - // this is requried for List branches or pull requests for a commit - // detail: https://developer.github.com/v3/previews/#list-branches-or-pull-requests-for-a-commit const client = github.getOctokit(args.repoToken); - //const commits = github.context.payload.commits if (!process.env.GITHUB_SHA) { return; } - const commits = [process.env.GITHUB_SHA]; - for (const commit of commits) { - const reviewed = yield verifyCommitReview(client, commit); - if (reviewed === false) { - //notify channel - var github_commit_url = `https://github.com/${github.context.repo.owner}/${github.context.repo.repo}/commit/${commit}`; - const req = request.post(args.slackEndpoint, { - json: { - text: `Unreviewed Commit from ${github_commit_url}`, - channel: `#${args.alertChannel}` - } - }, (error, res, body) => { - if (error) { - console.error(error); - return; - } - console.log(`statusCode: ${res.statusCode}`); - console.log(body); - }); - } + const commit = process.env.GITHUB_SHA; + const reviewed = yield verifyCommitReview(client, commit); + if (reviewed === false) { + //notify channel + var github_commit_url = `https://github.com/${github.context.repo.owner}/${github.context.repo.repo}/commit/${commit}`; + const req = request.post(args.slackEndpoint, { + json: { + text: `Unreviewed Commit from ${github_commit_url}`, + channel: `#${args.alertChannel}` + } + }, (error, res, body) => { + if (error) { + console.error(error); + return; + } + console.log(`statusCode: ${res.statusCode}`); + console.log(body); + }); } - ; } catch (error) { core.error(error); @@ -31515,6 +31509,7 @@ function verifyCommitReview(client, commit_sha) { const pull_requests = yield client.request("GET /repos/:owner/:repo/commits/:commit_sha/pulls", { mediaType: { //the function is only available for preview on github + // detail: https://developer.github.com/v3/previews/#list-branches-or-pull-requests-for-a-commit previews: ["groot"] }, owner: github.context.repo.owner,