Change summary
.github/workflows/update_all_top_ranking_issues.yml | 2
.github/workflows/update_weekly_top_ranking_issues.yml | 17 ++++++++++++
script/update_top_ranking_issues/main.py | 6 ++-
3 files changed, 22 insertions(+), 3 deletions(-)
Detailed changes
@@ -14,4 +14,4 @@ jobs:
architecture: "x64"
cache: "pip"
- run: pip install -r script/update_top_ranking_issues/requirements.txt
- - run: python script/update_top_ranking_issues/main.py --github-token ${{ secrets.GITHUB_TOKEN }} --prod
+ - run: python script/update_top_ranking_issues/main.py 5393 --github-token ${{ secrets.GITHUB_TOKEN }} --prod
@@ -0,0 +1,17 @@
+on:
+ schedule:
+ - cron: "0 17 * * SUN"
+ workflow_dispatch:
+
+jobs:
+ update_top_ranking_issues:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-python@v4
+ with:
+ python-version: "3.10.5"
+ architecture: "x64"
+ cache: "pip"
+ - run: pip install -r script/update_top_ranking_issues/requirements.txt
+ - run: python script/update_top_ranking_issues/main.py 6952 --github-token ${{ secrets.GITHUB_TOKEN }} --prod --query-day-interval 7
@@ -47,6 +47,7 @@ class IssueData:
@app.command()
def main(
+ issue_reference_number: int,
github_token: Optional[str] = None,
prod: bool = False,
query_day_interval: Optional[int] = None,
@@ -57,7 +58,8 @@ def main(
if query_day_interval:
tz = timezone("america/new_york")
- start_date = datetime.now(tz) - timedelta(days=query_day_interval)
+ current_time = datetime.now(tz).replace(hour=0, minute=0, second=0, microsecond=0)
+ start_date = current_time - timedelta(days=query_day_interval)
# 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
@@ -84,7 +86,7 @@ def main(
)
if prod:
- top_ranking_issues_issue: Issue = repository.get_issue(5393)
+ top_ranking_issues_issue: Issue = repository.get_issue(issue_reference_number)
top_ranking_issues_issue.edit(body=issue_text)
else:
print(issue_text)