Skip to content

Commit

Permalink
feat: getPreviousIssue returns open OR closed issues matching labels
Browse files Browse the repository at this point in the history
  • Loading branch information
imjohnbo committed Sep 9, 2021
1 parent dda8c02 commit f76bf37
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
15 changes: 9 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions lib/issue-bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ const getPreviousIssue = async (labels) => {

const data = (await octokit.rest.issues.listForRepo({
...context.repo,
labels
labels,
state: "all"
})).data[0];

if (data) {
Expand Down Expand Up @@ -357,12 +358,14 @@ const run = async (inputs) => {
// If there is a previous issue, close it out and point to the new
if (issueExists(previousIssueNumber) && inputs.closePrevious) {
await closeIssue(previousIssueNumber);
}

// If the pinned input is true, pin the current, unpin the previous
if (inputs.pinned) {
await unpin(previousIssueNodeId);
await pin(newIssueNodeId);
}
if (issueExists(previousIssueNumber) && inputs.pinned) {
await unpin(previousIssueNodeId);
}

if (inputs.pinned) {
await pin(newIssueNodeId);
}

if (newIssueNumber) {
Expand Down

0 comments on commit f76bf37

Please sign in to comment.