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 1 commit
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: 27 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,31 @@ async function main() {
.sort()
.toString();
const projectIssueLabelsStringified = getDevpoolIssueLabels(projectIssue, projectUrl).sort().toString();

// if bounty is unavailable and exists in the list with the state open then close such bounty
if (isDevpoolUnavailableLabel && devpoolIssue.state === "open") {
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: "closed",
});
console.log(`Closed (bounty is unavailable): ${devpoolIssue.html_url} (${projectIssue.html_url})`);
continue;
}

// if bounty is available exists in the list with the state closed then reopen such bounty
if (!isDevpoolUnavailableLabel && 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 (bounty is available): ${devpoolIssue.html_url} (${projectIssue.html_url})`);
continue;
}

// Update devpool issue if any of the following has been updated:
// - issue title
// - issue state (open/closed)
Expand Down Expand Up @@ -132,7 +157,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 issue has the "Unavailable" label then skip it, no need to pollute repo with new issues that are already taken
if (!(projectIssue.labels as GitHubLabel[]).some((label) => label.name.includes(LABELS.UNAVAILABLE))) continue;
rndquu marked this conversation as resolved.
Show resolved Hide resolved
// create a new issue
const createdIssue = await octokit.rest.issues.create({
owner: DEVPOOL_OWNER_NAME,
Expand Down
Loading