Skip to content

Commit 34c7b1f

Browse files
CopilotTimHess
andcommitted
Clarify why workflow runs every 30 days instead of 60
Co-authored-by: TimHess <3947063+TimHess@users.noreply.github.com>
1 parent ba20ecb commit 34c7b1f

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

.github/workflows/keep-alive.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,31 @@
44
# GitHub automatically disables scheduled workflows after 60 days of repository inactivity.
55
# This workflow prevents that by creating minimal activity when needed.
66
#
7+
# Important Constraint:
8+
# This workflow MUST run at least every 60 days. If it doesn't run for 60 days, GitHub will
9+
# disable it permanently and it won't be able to run itself anymore. Therefore, we schedule
10+
# it to run every 30 days (monthly) to ensure it always stays active, even if there are
11+
# holidays, weekends, or workflow execution delays.
12+
#
713
# How it works:
8-
# 1. Runs on the first day of every month
9-
# 2. Checks if the keep-alive PR exists
10-
# 3. If PR doesn't exist, creates it with a persistent branch
11-
# 4. Reopens the PR (if closed) and immediately closes it again
12-
# 5. This activity prevents workflow deactivation
14+
# 1. Runs on the first day of every month (~30 days)
15+
# 2. Checks if there's been activity in the last 30 days (commits on default branch)
16+
# 3. If no recent activity, creates/updates a persistent keep-alive PR:
17+
# - Creates a keep-alive branch (if it doesn't exist)
18+
# - Adds an empty commit to the branch
19+
# - Opens/reopens the PR and immediately closes it
20+
# 4. If recent activity exists, skips the keep-alive action to reduce noise
1321
#
1422
# Manual trigger:
1523
# This workflow can also be triggered manually via workflow_dispatch if needed.
1624
name: Keep Scheduled Workflows Alive
1725

1826
on:
1927
schedule:
28+
# Run on the 1st of every month (approximately every 30 days)
29+
# IMPORTANT: This MUST run at least every 60 days. If 60 days pass without running,
30+
# GitHub will disable this workflow and it won't be able to run itself anymore.
31+
# Running monthly (every ~30 days) ensures this never happens.
2032
- cron: "0 0 1 * *"
2133
workflow_dispatch:
2234

@@ -44,7 +56,8 @@ jobs:
4456
shell: bash
4557
run: |
4658
# Check if the repository has been active in the last 30 days
47-
# We check the default branch for recent commits
59+
# If there's been recent activity, we skip the keep-alive action to reduce noise.
60+
# We check the default branch for recent commits.
4861
4962
DEFAULT_BRANCH="${{ github.event.repository.default_branch }}"
5063
if [ -z "$DEFAULT_BRANCH" ]; then
@@ -64,7 +77,9 @@ jobs:
6477
6578
echo "Days since last activity: $days_diff"
6679
67-
# Threshold: 30 days (Run monthly, so if no activity in last month, we should act)
80+
# Threshold: 30 days
81+
# Since this workflow runs monthly, if there's been activity in the last 30 days,
82+
# we don't need to create additional keep-alive activity.
6883
if [ "$days_diff" -lt 30 ]; then
6984
echo "Repository is active enough (less than 30 days since last commit). No keep-alive action needed."
7085
echo "run_keep_alive=false" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)