Mirror LXC RootFS #14
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: Mirror LXC RootFS | |
| on: | |
| schedule: | |
| - cron: '0 6 * * *' # Every day at 06:00 UTC | |
| - cron: '0 18 * * *' # Every day at 18:00 UTC | |
| workflow_dispatch: | |
| jobs: | |
| mirror: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: pip install aiohttp beautifulsoup4 | |
| - name: Generate rootfs.json | |
| run: python3 fetch.py | |
| - name: Commit rootfs.json | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add rootfs.json | |
| if ! git diff --cached --quiet; then | |
| git commit -m "chore: update rootfs.json [$(date +'%Y-%m-%d')]" | |
| git pull --rebase origin main | |
| git push origin HEAD:main | |
| else | |
| echo "rootfs.json unchanged, nothing to commit" | |
| fi |