File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change 2929
3030 - name : Update keepalive timestamp
3131 run : |
32+ # Check if there are any commits in the last 30 days
33+ last_commit_date=$(git log -1 --format=%ct)
34+ current_date=$(date +%s)
35+ days_since_commit=$(( (current_date - last_commit_date) / 86400 ))
36+
37+ if [ $days_since_commit -lt 30 ]; then
38+ echo "Repository has commits within the last 30 days (${days_since_commit} days ago). Skipping keepalive update."
39+ exit 0
40+ fi
41+
42+ echo "No commits in the last ${days_since_commit} days. Updating keepalive timestamp."
3243 echo "Last keepalive: $(date -u)" > .github/keepalive
3344 git config --local user.email "[email protected] " 3445 git config --local user.name "GitHub Action"
3748 echo "No changes to commit"
3849 else
3950 git commit -m "chore: update keepalive timestamp [skip ci]"
51+
52+ # Push to the default branch (xpack)
4053 git push
41- fi
54+
55+ # Merge into xpack-development branch if it exists
56+ if git ls-remote --heads origin xpack-development | grep -q xpack-development; then
57+ echo "Merging keepalive update into xpack-development branch"
58+ current_branch=$(git rev-parse --abbrev-ref HEAD)
59+ git fetch origin xpack-development
60+ git checkout xpack-development
61+ git merge --no-edit ${current_branch}
62+ git push origin xpack-development
63+ git checkout ${current_branch}
64+ else
65+ echo "xpack-development branch does not exist, skipping merge"
66+ fi
67+ fi
You can’t perform that action at this time.
0 commit comments