File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,12 +115,21 @@ jobs:
115115 env :
116116 SLACK_BOT_TOKEN : ${{ secrets.SLACK_BOT_TOKEN }}
117117
118+ # Resets GitHub's 60-day scheduled-workflow inactivity timer (public repos only).
119+ # Commits via the REST Contents API so GitHub signs them (web-flow) and they pass
120+ # the "commits must have verified signatures" ruleset on main; plain git commits
121+ # from the runner are unsigned and get rejected. Non-fatal: keepalive must never
122+ # mask a real build result (the snapshot workflow gates on this run's success).
118123 - name : Keep workflow active
119124 if : always() && github.event_name == 'schedule'
125+ continue-on-error : true
126+ env :
127+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
120128 run : |
121- git config --global user.name "github-actions[bot]"
122- git config --global user.email "github-actions[bot]@users.noreply.github.com"
123- echo "Last workflow run: $(date -u)" > .github/.workflow-keep-alive
124- git add .github/.workflow-keep-alive
125- git diff --staged --quiet || git commit -m "chore: keep workflow active [skip ci]"
126- git push
129+ CONTENT=$(date -u +"Last workflow run: %Y-%m-%dT%H:%M:%SZ")
130+ SHA=$(gh api "repos/${{ github.repository }}/contents/.github/.workflow-keep-alive" --jq .sha 2>/dev/null || true)
131+ gh api -X PUT "repos/${{ github.repository }}/contents/.github/.workflow-keep-alive" \
132+ -f message="chore: keep workflow active [skip ci]" \
133+ -f content="$(printf '%s' "$CONTENT" | base64 -w0)" \
134+ ${SHA:+-f sha="$SHA"} \
135+ -f branch=main
You can’t perform that action at this time.
0 commit comments