generated from ubiquity/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 19
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
feat: task limit improvement #66
Merged
gentlementlegen
merged 24 commits into
ubiquity-os-marketplace:development
from
ariesgun:task-limit-improvement
Nov 8, 2024
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
5497d7e
feat: task limit improvement
ariesgun f00a9c6
feat: task limit improvement
ariesgun 3e18c1b
fix: fixed failing test
ariesgun cd96022
fix: used API to query orgs where the app is installed
ariesgun 0b63098
fix: added www. prefix
ariesgun 58fd4da
fix: query network in getAllPRs
ariesgun 734f97b
feat: update style
ariesgun ad20e32
fix: removed debug lines
ariesgun 044f8a8
fix: fix format and type
ariesgun 72cc120
fix: alternative way to list issues within network
ariesgun 0953019
fix: update mock handlers
ariesgun 2474312
fix: handle fetch error
ariesgun d09f2d4
fix: handle 404
ariesgun 8bf9f6f
fix: revert change in package.json
ariesgun 910ebf0
fix: update yarn.lock
ariesgun 239d26e
fix: cleanup
ariesgun 32e9280
feat: make issues and PRs search configurable
ubiquity-os[bot] d10db4a
Merge remote-tracking branch 'original/development' into task-limit-i…
ubiquity-os[bot] 0a6bd74
fix: updated yarn.lock
ubiquity-os[bot] 8fcedd9
fix: process review comments
ubiquity-os[bot] 87e7b16
fix: renamed checkIssues to assignedIssueScope
ubiquity-os[bot] 986261a
fix: convert AssignedIssueScope to enum
ubiquity-os[bot] d8fead7
fix: handle search API private repo
ubiquity-os[bot] 3827d28
fix: undo changes in manifest
ubiquity-os[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { AssignedIssueScope, Context, GitHubIssueSearch } from "../types"; | ||
|
||
export async function listOrganizations(context: Context): Promise<string[]> { | ||
const { | ||
config: { assignedIssueScope }, | ||
logger, | ||
payload, | ||
} = context; | ||
|
||
if (assignedIssueScope === AssignedIssueScope.REPO || assignedIssueScope === AssignedIssueScope.ORG) { | ||
return [payload.repository.owner.login]; | ||
} else if (assignedIssueScope === AssignedIssueScope.NETWORK) { | ||
const orgsSet: Set<string> = new Set(); | ||
const urlPattern = /https:\/\/github\.com\/(\S+)\/\S+\/issues\/\d+/; | ||
|
||
const url = "https://raw.githubusercontent.com/ubiquity/devpool-directory/refs/heads/__STORAGE__/devpool-issues.json"; | ||
const response = await fetch(url); | ||
if (!response.ok) { | ||
if (response.status === 404) { | ||
throw logger.error(`Error 404: unable to fetch file devpool-issues.json ${url}`); | ||
} else { | ||
throw logger.error("Error fetching file devpool-issues.json.", { status: response.status }); | ||
} | ||
} | ||
|
||
const devpoolIssues: GitHubIssueSearch["items"] = await response.json(); | ||
devpoolIssues.forEach((issue) => { | ||
const match = issue.html_url.match(urlPattern); | ||
if (match) { | ||
orgsSet.add(match[1]); | ||
} | ||
}); | ||
|
||
return [...orgsSet]; | ||
} | ||
|
||
throw new Error("Unknown assignedIssueScope value. Supported values: ['org', 'repo', 'network']"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be here but in the configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the reasoning is that it's needed at multiple places so they just put it in the context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec states:
Shouldn't this be configurable? And even if not, putting it in the config also allows to add defaults on decode which would ensure it is properly initialized and types as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure. It mentions the scope is configurable: repo, org , or network.. Dont understand what you meant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe I'm missing something, but the config item
assignedIssueScope
can be set torepo
,org
ornetwork
, thisconfiguration
property gets filled based onassignedIssueScope
when the plugin startsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that's how it behaves.. Based on
assignedIssueScope
, it will fill in theorganization
accordingly.