-
Notifications
You must be signed in to change notification settings - Fork 2
Keep scheduled workflows alive #128
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: TimHess <[email protected]>
Co-authored-by: TimHess <[email protected]>
…umentation Co-authored-by: TimHess <[email protected]>
Co-authored-by: TimHess <[email protected]>
|
@copilot I didn't realize opening and closing a PR would be a viable solution here - can it be the same PR (or issue) that's closed/open/modified? If we could edit or open/close the same PR it would be even less of a hassle. Also, this process doesn't appear to require human intervention, so we can run it every 59 days and forget about the buffer window |
Co-authored-by: TimHess <[email protected]>
Yes, great suggestions! I've updated the workflow to:
The workflow now:
Commit: cfa441d |
- bump a couple other action refs - whitespace cleanup
.github/workflows/keep-alive.yml
Outdated
| # 1. Runs on the first day of every month | ||
| # 2. Checks if the keep-alive PR exists | ||
| # 3. If PR doesn't exist, creates it with a persistent branch | ||
| # 4. Reopens the PR (if closed) and immediately closes it again | ||
| # 5. This activity prevents workflow deactivation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the PR_BODY below don't indicate that an empty commit is being pushed.
| echo "pr_number=$pr_number" >> $GITHUB_OUTPUT | ||
| id: setup | ||
|
|
||
| - name: Reopen and close PR to maintain activity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to here, status checks won't run on a PR created by a schedule to prevent infinite recursion. So I wonder whether this actually helps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need the status checks to run on the keep-alive PR though, since we're just trying to keep github from deactivating the other scheduled job.
|
|
||
| if [ -z "$pr_number" ]; then | ||
| echo "Creating new PR for keep-alive workflow" | ||
| gh pr create \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the PR created in Draft mode? If not, it should.
Co-authored-by: TimHess <[email protected]>
Co-authored-by: TimHess <[email protected]>
GitHub disables scheduled workflows after 60 days of repository inactivity. This workflow prevents deactivation.
Implementation
keep-alive-workflowbranchWhy empty commits
Empty commits generate activity without modifying repository content. The draft PR is reopened/closed to register activity.
Fully automated. No human intervention required.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.