File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Keep Alive
2+
3+ # This workflow is designed to keep the repository active.
4+ # GitHub automatically disables all actions with a cron trigger after 60 days of inactivity.
5+ # This action checks if there has been a commit in the last 55 days.
6+ # If a commit is found within this timeframe, the workflow does nothing,
7+ # however, if no commits have been made, it performs an empty push to keep the repository active.
8+
9+ on :
10+ workflow_dispatch :
11+ schedule :
12+ - cron : ' 0 0 * * *' # Run at 00:00 every day
13+ push :
14+ branches :
15+ - keep-alive
16+
17+ jobs :
18+ keep_alive :
19+ runs-on : ' ubuntu-latest'
20+ permissions :
21+ contents : read
22+ actions : write
23+
24+ steps :
25+ - name : Checkout
26+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.7
27+
28+ - name : Calculate days since last commit
29+ id : commit_date
30+ run : |
31+ LAST_COMMIT_DATE=$(git log -1 --format=%ct)
32+ echo "Last commit date: $LAST_COMMIT_DATE"
33+
34+ CURRENT_DATE=$(date +%s)
35+ echo "Current date: $CURRENT_DATE"
36+
37+ # Calculate how many days have passed since the last commit
38+ DIFFERENCE=$(( ($CURRENT_DATE - $LAST_COMMIT_DATE) / 86400 ))
39+ echo "Days since last commit: $DIFFERENCE"
40+
41+ echo "days_since_commit=$DIFFERENCE" >> $GITHUB_ENV
42+
43+ - name : Keep Alive
44+ # If 55 days have passed then execute the action which makes an empty push
45+ if : steps.commit_date.outputs.days_since_commit >= '55'
46+ uses : pagopa/dx/.github/actions/keep-alive/@main
You can’t perform that action at this time.
0 commit comments