Skip to content

Commit

Permalink
action: skip comment search if ticket not found (likely unpinned)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasrangit committed Sep 29, 2020
1 parent debade5 commit db130bb
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,20 @@ async function run() {

// Check for existing vacation mode activated comment
vacation_comment_id = 0;
await octokit.issues.listComments({
owner: owner,
repo: repo,
issue_number: vacation_issue_number,
}).then(comments => {
for (let comment of comments.data) {
if (comment.user.login == owner && comment.body.includes('vacation-mode-activated')) {
vacation_comment_id = comment.id;
break;
if (vacation_issue_number != 0) {
await octokit.issues.listComments({
owner: owner,
repo: repo,
issue_number: vacation_issue_number,
}).then(comments => {
for (let comment of comments.data) {
if (comment.user.login == owner && comment.body.includes('vacation-mode-activated')) {
vacation_comment_id = comment.id;
break;
}
}
}
});
});
}

// Always remove repository interaction restrictions first in order to reset the 24 hour timer
// and to handle the case when the vacation issue is unpinned (#3)
Expand Down

0 comments on commit db130bb

Please sign in to comment.