Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

Commit 495581f

Browse files
author
shiqi
authored
Merge pull request #54 from tinyspeck/rls-1.1.0
1.1.0 release
2 parents 68456db + a4e1921 commit 495581f

File tree

1 file changed

+19
-24
lines changed

1 file changed

+19
-24
lines changed

dist/index.js

+19-24
Original file line numberDiff line numberDiff line change
@@ -31470,35 +31470,29 @@ function runPushAlert(args) {
3147031470
if (!args.slackEndpoint) {
3147131471
throw new Error('Slack notification endpoint undefined');
3147231472
}
31473-
// this is requried for List branches or pull requests for a commit
31474-
// detail: https://developer.github.com/v3/previews/#list-branches-or-pull-requests-for-a-commit
3147531473
const client = github.getOctokit(args.repoToken);
31476-
//const commits = github.context.payload.commits
3147731474
if (!process.env.GITHUB_SHA) {
3147831475
return;
3147931476
}
31480-
const commits = [process.env.GITHUB_SHA];
31481-
for (const commit of commits) {
31482-
const reviewed = yield verifyCommitReview(client, commit);
31483-
if (reviewed === false) {
31484-
//notify channel
31485-
var github_commit_url = `https://github.com/${github.context.repo.owner}/${github.context.repo.repo}/commit/${commit}`;
31486-
const req = request.post(args.slackEndpoint, {
31487-
json: {
31488-
text: `Unreviewed Commit from ${github_commit_url}`,
31489-
channel: `#${args.alertChannel}`
31490-
}
31491-
}, (error, res, body) => {
31492-
if (error) {
31493-
console.error(error);
31494-
return;
31495-
}
31496-
console.log(`statusCode: ${res.statusCode}`);
31497-
console.log(body);
31498-
});
31499-
}
31477+
const commit = process.env.GITHUB_SHA;
31478+
const reviewed = yield verifyCommitReview(client, commit);
31479+
if (reviewed === false) {
31480+
//notify channel
31481+
var github_commit_url = `https://github.com/${github.context.repo.owner}/${github.context.repo.repo}/commit/${commit}`;
31482+
const req = request.post(args.slackEndpoint, {
31483+
json: {
31484+
text: `Unreviewed Commit from ${github_commit_url}`,
31485+
channel: `#${args.alertChannel}`
31486+
}
31487+
}, (error, res, body) => {
31488+
if (error) {
31489+
console.error(error);
31490+
return;
31491+
}
31492+
console.log(`statusCode: ${res.statusCode}`);
31493+
console.log(body);
31494+
});
3150031495
}
31501-
;
3150231496
}
3150331497
catch (error) {
3150431498
core.error(error);
@@ -31515,6 +31509,7 @@ function verifyCommitReview(client, commit_sha) {
3151531509
const pull_requests = yield client.request("GET /repos/:owner/:repo/commits/:commit_sha/pulls", {
3151631510
mediaType: {
3151731511
//the function is only available for preview on github
31512+
// detail: https://developer.github.com/v3/previews/#list-branches-or-pull-requests-for-a-commit
3151831513
previews: ["groot"]
3151931514
},
3152031515
owner: github.context.repo.owner,

0 commit comments

Comments
 (0)