-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Top Ranking Issues #2267
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
Merged
Merged
Top Ranking Issues #2267
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0bbfdc4
reset top ranking issues
kurt-rhee 475a166
flake8 fixes
kurt-rhee 66685b1
Create top-ranked-issues.yml
AdamRJensen 0cc31a3
Update f-string formatting
AdamRJensen d4fccf8
Change Cron job to every 10 minutes
AdamRJensen a1ae0d5
Merge branch 'main' into main
AdamRJensen e453984
Add quotes to cron schedule
AdamRJensen 322e659
excluding the overview card from the ranked list and changing token n…
kurt-rhee 568ac34
changed back to GITHUB_ACCESS_TOKEN
kurt-rhee 2ffc687
Update scripts/update_top_ranking_issues.py
kurt-rhee 7f1d15a
added break condnition on generator
kurt-rhee 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 hidden or 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 hidden or 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,74 @@ | ||
import os | ||
from datetime import datetime, timedelta | ||
|
||
from github import Github | ||
from github.Issue import Issue | ||
from github.Repository import Repository | ||
|
||
|
||
def main(): | ||
start_time: datetime = datetime.now() | ||
|
||
# --- Initialization --- | ||
# GitHub Workflow will pass in the token as an environment variable, | ||
# but we can place it in our env when running the script locally, | ||
# for convenience | ||
local_github_token: str | None = None | ||
github_token: str | None = ( | ||
local_github_token or os.getenv("GITHUB_TOKEN") | ||
) | ||
github = Github(github_token) | ||
|
||
# repository name | ||
repo_name: str = "pvlib/pvlib-python" | ||
repository: Repository = github.get_repo(repo_name) | ||
|
||
# Number of top issues to list | ||
MAX_ISSUES = 19 | ||
TOP_ISSUES_CARD_NUMBER = 2196 | ||
|
||
# Rate limiting | ||
remaining_requests_before: int = github.rate_limiting[0] | ||
print(f"Remaining requests before: {remaining_requests_before}") | ||
|
||
# --- Actions --- | ||
# Get sorted issues | ||
query: str = ( | ||
f'repo:{repository.full_name} is:open is:issue sort:reactions-+1-desc' | ||
) | ||
issues = github.search_issues(query) | ||
|
||
# Format markdown | ||
ranked_issues = [] | ||
for (i, issue) in zip(range(MAX_ISSUES), issues): | ||
|
||
# Don't include the overview card | ||
if issue.number == TOP_ISSUES_CARD_NUMBER: | ||
pass | ||
|
||
markdown_bullet_point: str = ( | ||
f"{issue.html_url} " + | ||
f"({issue._rawData['reactions']['+1']} :thumbsup:)" | ||
) | ||
|
||
markdown_bullet_point = f"{i + 1}. {markdown_bullet_point}" | ||
ranked_issues.append(markdown_bullet_point) | ||
|
||
# edit top issues | ||
top_issues_card: Issue = repository.get_issue( | ||
number=TOP_ISSUES_CARD_NUMBER | ||
) | ||
header = "Top Ranking Issues" | ||
new_body = header + "\n" + "\n".join(ranked_issues) | ||
top_issues_card.edit( | ||
body=new_body | ||
) | ||
|
||
print(top_issues_card.body) | ||
|
||
run_duration: timedelta = datetime.now() - start_time | ||
print(run_duration) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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.
Uh oh!
There was an error while loading. Please reload this page.