github-alive #79
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: github-alive | |
| on: | |
| schedule: | |
| # Runs at 02:00, 10:00, and 18:00 UTC every day | |
| - cron: '0 2,10,18 * * *' | |
| workflow_dispatch: # Allow manual trigger from GitHub UI | |
| jobs: | |
| alive: | |
| name: Keep the graph alive | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Needed to push commits via the API | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: pip install requests | |
| - name: Run alive.py | |
| env: | |
| ALIVE_GH_TOKEN: ${{ secrets.ALIVE_TOKEN }} | |
| GITHUB_USER: ${{ secrets.GH_USER }} | |
| GITHUB_REPO: alive | |
| run: python3 alive.py | |
| - name: Keep this repo active | |
| # GitHub disables scheduled workflows after 60 days of repo inactivity. | |
| # alive.py commits to the 'alive' repo — not this one. So we write a | |
| # tiny timestamp file here to keep github-alive alive. | |
| run: | | |
| git config user.name "github-alive" | |
| git config user.email "github-alive@users.noreply.github.com" | |
| echo "$(date -u +%Y-%m-%dT%H:%M:%SZ)" > .last_run | |
| git add .last_run | |
| git diff --staged --quiet || git commit -m "ci: $(date -u +%Y-%m-%d)" | |
| git pull --rebase origin main | |
| git push |