Skip to content

CI

CI #857

Workflow file for this run

name: CI
on:
workflow_dispatch:
schedule:
- cron: "0 16 * * *"
jobs:
check:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Should build?
id: should_build
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if ! git checkout origin/update build.md; then
echo "first time building!"
echo "SHOULD_BUILD=1" >> $GITHUB_OUTPUT
else
UPDATE_CFG=$(./build.sh config.toml --config-update)
if [ "$UPDATE_CFG" ]; then
echo "SHOULD_BUILD=1" >> $GITHUB_OUTPUT
else
echo "SHOULD_BUILD=0" >> $GITHUB_OUTPUT
fi
fi
- name: Clear older runs
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh run list -L400 --json databaseId -q '.[].databaseId' | tail -n+10 | xargs -IID gh api "repos/$GITHUB_REPOSITORY/actions/runs/ID" -X DELETE || :
outputs:
SHOULD_BUILD: ${{ steps.should_build.outputs.SHOULD_BUILD }}
build:
permissions: write-all
needs: check
uses: ./.github/workflows/build.yml
if: ${{ needs.check.outputs.SHOULD_BUILD == 1 }}
secrets: inherit