cron-demo/.gitea/workflows/cron.yml
giteaadmin 85f2b4fc20
Some checks failed
on-push-smoke / smoke (push) Failing after 2m45s
feat: add continuous cron workflow and sample task
Add a schedule workflow every 2 minutes with chained jobs,
plus a push smoke workflow to verify the runner immediately.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 13:48:09 +00:00

53 lines
1.4 KiB
YAML

name: continuous-cron
on:
schedule:
# 每 2 分钟触发一次,方便观察连续定时任务
- cron: "*/2 * * * *"
workflow_dispatch:
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: prepare marker
run: |
echo "prepare at $(date -u +%Y-%m-%dT%H:%M:%SZ)"
echo "run_id=${{ github.run_id }}"
echo "event=${{ github.event_name }}"
mkdir -p artifacts
echo "prepared" > artifacts/prepare.txt
cat artifacts/prepare.txt
work:
runs-on: ubuntu-latest
needs: prepare
steps:
- name: checkout
uses: actions/checkout@v4
- name: run business task
env:
TASK_OUT_DIR: artifacts
run: |
python3 app/task.py
ls -la artifacts
- name: simulate work
run: |
echo "working..."
sleep 3
echo "work done"
report:
runs-on: ubuntu-latest
needs: work
steps:
- name: summary
run: |
echo "## Continuous Cron Report" >> $GITHUB_STEP_SUMMARY
echo "- run_id: ${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
echo "- event: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
echo "- time_utc: $(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_STEP_SUMMARY
echo "report finished at $(date -u +%Y-%m-%dT%H:%M:%SZ)"