diff --git a/.github/workflows/update_top_ranking_issues.yml b/.github/workflows/update_all_top_ranking_issues.yml similarity index 89% rename from .github/workflows/update_top_ranking_issues.yml rename to .github/workflows/update_all_top_ranking_issues.yml index 8b93bee7e2..0ffdb6aeb2 100644 --- a/.github/workflows/update_top_ranking_issues.yml +++ b/.github/workflows/update_all_top_ranking_issues.yml @@ -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 diff --git a/.github/workflows/update_weekly_top_ranking_issues.yml b/.github/workflows/update_weekly_top_ranking_issues.yml new file mode 100644 index 0000000000..38f32ddd5a --- /dev/null +++ b/.github/workflows/update_weekly_top_ranking_issues.yml @@ -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 diff --git a/script/update_top_ranking_issues/main.py b/script/update_top_ranking_issues/main.py index 8c42008d14..bad453e128 100644 --- a/script/update_top_ranking_issues/main.py +++ b/script/update_top_ranking_issues/main.py @@ -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)