mirror of
https://github.com/multipleof4/gitea-github-cron.git
synced 2026-10-15 16:27:53 +00:00
Schedule mirror cleanup at 3 AM Central using UTC
This commit is contained in:
@@ -3,19 +3,32 @@ name: Rename deleted GitHub mirrors
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 3 * * *'
|
- cron: '0 8 * * *' # 3 AM CDT
|
||||||
timezone: America/Chicago
|
- cron: '0 9 * * *' # 3 AM CST
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
rename:
|
rename:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Check Central time
|
||||||
|
id: central
|
||||||
|
if: github.event_name == 'schedule'
|
||||||
|
env:
|
||||||
|
SCHEDULE: ${{ github.event.schedule }}
|
||||||
|
run: |
|
||||||
|
hour=$(echo "$SCHEDULE" | cut -d' ' -f2)
|
||||||
|
if [ "$(TZ=America/Chicago date -d "$(date -u +%F) ${hour}:00 UTC" +%H)" = 03 ]; then
|
||||||
|
echo 'run=true' >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' || steps.central.outputs.run == 'true' }}
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' || steps.central.outputs.run == 'true' }}
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
- name: Rename mirrors missing on GitHub
|
- name: Rename mirrors missing on GitHub
|
||||||
id: sync
|
id: sync
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' || steps.central.outputs.run == 'true' }}
|
||||||
run: node rename-gone-mirrors.js
|
run: node rename-gone-mirrors.js
|
||||||
env:
|
env:
|
||||||
GH_PAT: ${{ secrets.GH_PAT }}
|
GH_PAT: ${{ secrets.GH_PAT }}
|
||||||
@@ -23,7 +36,7 @@ jobs:
|
|||||||
GITEA_URL: ${{ secrets.GITEA_URL }}
|
GITEA_URL: ${{ secrets.GITEA_URL }}
|
||||||
|
|
||||||
- name: Notify via ntfy
|
- name: Notify via ntfy
|
||||||
if: ${{ always() }}
|
if: ${{ always() && (github.event_name == 'workflow_dispatch' || steps.central.outputs.run == 'true') }}
|
||||||
run: node notify.js
|
run: node notify.js
|
||||||
env:
|
env:
|
||||||
NTFY_TOPIC_URL: ${{ secrets.NTFY_TOPIC_URL }}
|
NTFY_TOPIC_URL: ${{ secrets.NTFY_TOPIC_URL }}
|
||||||
|
|||||||
Reference in New Issue
Block a user