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

chore: hide unavailable bounties #1102

Merged
merged 8 commits into from
Mar 13, 2024
Merged
Changes from 6 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
28 changes: 28 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,39 @@ async function main() {
}
continue;
}

// if the project issue is assigned to someone and it's open in the devpool, then close it
if (projectIssue.assignee?.login && devpoolIssue.state === "open") {
await octokit.rest.issues.update({
owner: DEVPOOL_OWNER_NAME,
repo: DEVPOOL_REPO_NAME,
issue_number: devpoolIssue.number,
state: "closed",
});
console.log(`Closed (assigned): ${devpoolIssue.html_url} (${projectIssue.html_url})`);
continue;
}

// if the project issue is not assigned to someone and it's closed in the devpool, then reopen it
if (!projectIssue.assignee?.login && devpoolIssue.state === "closed") {
rndquu marked this conversation as resolved.
Show resolved Hide resolved
await octokit.rest.issues.update({
owner: DEVPOOL_OWNER_NAME,
repo: DEVPOOL_REPO_NAME,
issue_number: devpoolIssue.number,
state: "open",
});
console.log(`Reopened (unassigned): ${devpoolIssue.html_url} (${projectIssue.html_url})`);
continue;
}

// prepare for issue updating
const isDevpoolUnavailableLabel = (devpoolIssue.labels as GitHubLabel[])?.some((label) => label.name === LABELS.UNAVAILABLE);
const devpoolIssueLabelsStringified = (devpoolIssue.labels as GitHubLabel[])
.map((label) => label.name)
.sort()
.toString();
const projectIssueLabelsStringified = getDevpoolIssueLabels(projectIssue, projectUrl).sort().toString();

// Update devpool issue if any of the following has been updated:
// - issue title
// - issue state (open/closed)
Expand Down Expand Up @@ -132,6 +158,8 @@ async function main() {
if (projectIssue.state === "closed") continue;
// if issue doesn't have the "Price" label then skip it, no need to pollute repo with draft issues
if (!(projectIssue.labels as GitHubLabel[]).some((label) => label.name.includes(LABELS.PRICE))) continue;
// if the project issue is assigned to someone, then skip it
if (projectIssue.assignee?.login) continue;

// create a new issue
const createdIssue = await octokit.rest.issues.create({
Expand Down
Loading