Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: close assigned issue logic #1157

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async function main() {
issue_number: devpoolIssue.number,
title: projectIssue.title,
body,
state: projectIssue.state as "open" | "closed",
state: !isDevpoolUnavailableLabel ? (projectIssue.state as "open" | "closed") : "closed",
labels: getDevpoolIssueLabels(projectIssue, projectUrl),
});
console.log(`Updated: ${devpoolIssue.html_url} (${projectIssue.html_url})`);
Expand Down
26 changes: 26 additions & 0 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,30 @@ describe("Devpool Updates", () => {
},
]);
});

test("Close devpool issues when the issue has been assigned in other projects", async () => {
db.issue.create({
...issueDevpoolTemplate,
id: 1,
owner: DEVPOOL_OWNER_NAME,
repo: DEVPOOL_REPO_NAME,
});
db.issue.create({
...issueTemplate,
id: 2,
assignee: { ...issueTemplate.assignee, login: "john doe" },
owner: DEVPOOL_OWNER_NAME,
repo: "test-repo",
});
await main();
const devpoolIssue = await getAllIssues(DEVPOOL_OWNER_NAME, DEVPOOL_REPO_NAME);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const devpoolIssue = await getAllIssues(DEVPOOL_OWNER_NAME, DEVPOOL_REPO_NAME);
const devpoolIssues = await getAllIssues(DEVPOOL_OWNER_NAME, DEVPOOL_REPO_NAME);


expect(devpoolIssue).toMatchObject([
{
...issueDevpoolTemplate,
id: 1,
state: "closed",
},
]);
});
});
Loading