Skip to content

Conversation

Copy link

Copilot AI commented Jan 29, 2026

GitHub disables scheduled workflows after 60 days of repository inactivity. This workflow prevents deactivation.

Implementation

  • Monthly cron check (1st of month) - must run within 60 days or workflow disables itself
  • Checks last commit date on default branch
  • If inactive >30 days: creates/updates draft PR with empty commits on persistent keep-alive-workflow branch
  • If active: no-op

Why empty commits

Empty commits generate activity without modifying repository content. The draft PR is reopened/closed to register activity.

# Runs monthly, must execute within 60 days
schedule:
  - cron: "0 0 1 * *"

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.

Copilot AI changed the title [WIP] Add job to keep repository alive via scheduled trigger Add automated keep-alive workflow for scheduled jobs Jan 29, 2026
Copilot AI requested a review from TimHess January 29, 2026 17:26
@TimHess
Copy link
Member

TimHess commented Jan 29, 2026

@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

Copy link
Author

Copilot AI commented Jan 29, 2026

@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 b...

Yes, great suggestions! I've updated the workflow to:

  1. Reuse the same PR: Uses a persistent branch (keep-alive-workflow) and the same PR that gets reopened/closed each time. Much cleaner than creating new PRs.

  2. Run every ~59 days: Changed from monthly to cron: "0 0 1 */2 *" (every 2 months = ~59-62 days). Since this requires no human intervention, we don't need the extra buffer.

The workflow now:

  • Creates one persistent branch and PR on first run
  • Every ~59 days: reopens the PR (if closed) then immediately closes it with a timestamp comment
  • Zero noise after initial setup

Commit: cfa441d

@TimHess TimHess marked this pull request as ready for review January 30, 2026 21:19
@TimHess TimHess marked this pull request as draft January 30, 2026 21:20
@TimHess TimHess marked this pull request as ready for review February 2, 2026 22:28
@TimHess TimHess requested a review from bart-vmware February 2, 2026 22:29
Comment on lines 8 to 12
# 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
Copy link
Member

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
Copy link
Member

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.

Copy link
Member

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 \
Copy link
Member

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.

Copilot AI changed the title Add automated keep-alive workflow for scheduled jobs Document critical constraint: keep-alive workflow must run every 30 days Feb 3, 2026
@TimHess TimHess changed the title Document critical constraint: keep-alive workflow must run every 30 days add keep-alive workflow Feb 3, 2026
Copilot AI changed the title add keep-alive workflow Reduce workflow verbosity and create draft PRs Feb 3, 2026
Copilot AI changed the title Reduce workflow verbosity and create draft PRs Keep scheduled workflows alive Feb 3, 2026
@TimHess TimHess requested a review from bart-vmware February 3, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants