Skip to content

Commit a6dd4e6

Browse files
committed
Sync: Automated sync from main to public branch.
1 parent 2126605 commit a6dd4e6

File tree

2 files changed

+34
-13
lines changed

2 files changed

+34
-13
lines changed

.github/workflows/keep-alive.yml

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,47 @@
11
name: Keep GitHub Actions Alive
22
on:
3-
# Run once a week, well before the 60-day deadline
4-
schedule:
5-
- cron: '0 0 * * SUN' # Runs every Sunday at 00:00 UTC
63
# Allows manual triggering
74
workflow_dispatch:
5+
# Run once a week, well before the 60-day deadline
6+
schedule:
7+
# Run every Sunday at 00:00 UTC
8+
- cron: '0 0 * * SUN'
89

910
jobs:
1011
keep_alive:
1112
runs-on: ubuntu-latest
1213

1314
# Required permission to interact with the GitHub API to re-enable workflows
1415
permissions:
16+
# Critical: allows enabling workflows
1517
actions: write
1618

1719
steps:
18-
- name: Keepalive Workflow (API Mode - No Commit)
19-
uses: gautamkrishnar/keepalive-workflow@v1
20-
with:
21-
# This defaults to true, which uses the API to re-enable
22-
use_api: true
23-
# The token needs 'actions:write' permission
24-
github_token: ${{ secrets.GITHUB_TOKEN }}
25-
# Recommended: Set a threshold lower than 60 days (e.g., 50 days)
26-
time_elapsed_threshold_in_days: 50
20+
# Use API to re-enable workflows (clean, no commit)
21+
- name: Re-enable workflows via GitHub API
22+
env:
23+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
run: |
25+
# List all workflows that are disabled (by user or inactivity)
26+
# Note: GitHub API doesn't have direct ?state=disabled filter, so we fetch all and grep jq
27+
disabled_workflows=$(gh api \
28+
-H "Accept: application/vnd.github+json" \
29+
"/repos/${{ github.repository }}/actions/workflows" \
30+
| jq -r '.workflows[] | select(.state != "active") | .id')
31+
32+
if [ -z "$disabled_workflows" ]; then
33+
echo "No disabled workflows found. This is normal if nothing is disabled yet."
34+
exit 0
35+
fi
36+
37+
count=0
38+
for wf_id in $disabled_workflows; do
39+
gh api \
40+
-X PUT \
41+
-H "Accept: application/vnd.github+json" \
42+
"/repos/${{ github.repository }}/actions/workflows/$wf_id/enable"
43+
echo "Enabled workflow ID: $wf_id"
44+
((count++))
45+
done
46+
47+
echo "Re-enabled $count workflow(s)."

ansible

Submodule ansible updated 1070 files

0 commit comments

Comments
 (0)