Skip to content
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

Fixes PR updated_at comparison on Housekeep Actions #690

Merged
merged 1 commit into from
Feb 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,20 @@ jobs:
run: pip install PyGithub
- name: Update PRs
run: |
from datetime import datetime
from datetime import datetime, timezone
from github import Auth, Github

now = datetime.now()
now = datetime.now(timezone.utc)
gh = Github(auth=Auth.Token("${{ secrets.GITHUB_TOKEN }}"))
repo = gh.get_repo("${{ github.repository }}")

for pull in repo.get_pulls("open", "updated", "desc", "${{ github.ref_name }}"):
if (now - pull.updated_at).days > 30:
break
pull.add_to_labels("B-out-of-date")
ood = False
for label in pull.labels:
if label.name == "B-out-of-date":
ood = True
if not ood:
pull.add_to_labels("B-out-of-date")
shell: python