Skip to content

Commit

Permalink
Fixes PR updated_at comparison on Housekeep Actions (#690)
Browse files Browse the repository at this point in the history
  • Loading branch information
ultimaweapon committed Feb 24, 2024
1 parent 6c50ad0 commit 7c306e6
Showing 1 changed file with 8 additions and 3 deletions.
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

0 comments on commit 7c306e6

Please sign in to comment.