Add a weekly report
This commit is contained in:
parent
6305761064
commit
80cdd60d4c
3 changed files with 22 additions and 3 deletions
|
@ -14,4 +14,4 @@ jobs:
|
||||||
architecture: "x64"
|
architecture: "x64"
|
||||||
cache: "pip"
|
cache: "pip"
|
||||||
- run: pip install -r script/update_top_ranking_issues/requirements.txt
|
- 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
|
17
.github/workflows/update_weekly_top_ranking_issues.yml
vendored
Normal file
17
.github/workflows/update_weekly_top_ranking_issues.yml
vendored
Normal file
|
@ -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()
|
@app.command()
|
||||||
def main(
|
def main(
|
||||||
|
issue_reference_number: int,
|
||||||
github_token: Optional[str] = None,
|
github_token: Optional[str] = None,
|
||||||
prod: bool = False,
|
prod: bool = False,
|
||||||
query_day_interval: Optional[int] = None,
|
query_day_interval: Optional[int] = None,
|
||||||
|
@ -57,7 +58,8 @@ def main(
|
||||||
|
|
||||||
if query_day_interval:
|
if query_day_interval:
|
||||||
tz = timezone("america/new_york")
|
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,
|
# 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
|
# but we can place it in our env when running the script locally, for convenience
|
||||||
|
@ -84,7 +86,7 @@ def main(
|
||||||
)
|
)
|
||||||
|
|
||||||
if prod:
|
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)
|
top_ranking_issues_issue.edit(body=issue_text)
|
||||||
else:
|
else:
|
||||||
print(issue_text)
|
print(issue_text)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue