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

Add cron based policies #483

Open
TRAD-Anthony-CKO opened this issue Apr 14, 2024 · 3 comments
Open

Add cron based policies #483

TRAD-Anthony-CKO opened this issue Apr 14, 2024 · 3 comments
Labels
enhancement New feature or request roadmap

Comments

@TRAD-Anthony-CKO
Copy link

Is your feature request related to a problem? Please describe.
I wanted to write a policy that auto-close some PRs after a certain time (5 Days for example). I didn't find anything about supporting scheduled runs in policies. Is that supported somewhere? Any example I can use as a baseline?

Describe the solution you'd like
Here's an example policy I tried to write:

# -*- mode: yaml -*-

manifest:
  version: 1.0

automations:
  auto_close_old_prs:
    schedule:
      cron: "0 0 * * *"
    if:
      - {{ pull_request.age_days > 10 }}
      - {{ 'auto-close' in pull_request.labels }}
    run:
      - action: close-pr@v1
        args:
          reason: "This PR has been automatically closed as it has been open for more than 10 days without being merged or updated and is tagged with 'auto-close'. Please feel free to reopen or create a new PR if the changes are still relevant."

pull_request:
  age_days: {{ now() | date:'Y-m-d' | diff(pull_request.created_at | date:'Y-m-d') | days }}
  labels: {{ pull_request.labels | map(attribute='name') }}  
@TRAD-Anthony-CKO TRAD-Anthony-CKO added the enhancement New feature or request label Apr 14, 2024
@PavelLinearB
Copy link
Collaborator

Hi @TRAD-Anthony-CKO, thanks for raising this issue
We are planning to add a cron trigger. But I'd like to make sure that our planned feature will address this use case
I will update here on the details and ETA

@TRAD-Anthony-CKO
Copy link
Author

Hi @PavelLinearB
Any updates on this or ETA you can share? Thanks.

@vim-zz
Copy link
Collaborator

vim-zz commented Jun 5, 2024

Hi @TRAD-Anthony-CKO I can confirm that this has been prioritized. However, I cannot provide a specific date at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request roadmap
Projects
None yet
Development

No branches or pull requests

3 participants