diff --git a/.github/workflows/update-fls.yaml b/.github/workflows/update-fls.yaml new file mode 100644 index 0000000..55aa3f9 --- /dev/null +++ b/.github/workflows/update-fls.yaml @@ -0,0 +1,26 @@ +name: Update FLS +on: + schedule: + - cron: "05 0 * * *" + workflow_dispatch: +jobs: + update-fls: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v6 + - name: Update FLS + run: | + ./test_update_fls.sh + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4 + with: + commit-message: Update FLS (automated PR) + title: Update FLS (automated PR) + body: Update FLS (automated PR) + base: main + labels: automated-pr + branch: update-fls + delete-branch: true diff --git a/builder/build_cli.py b/builder/build_cli.py index a3201e0..d935c02 100644 --- a/builder/build_cli.py +++ b/builder/build_cli.py @@ -49,7 +49,7 @@ def build_docs( dest = root / "build" - args = ["-b", builder, "-d", dest / "doctrees"] + args = ["-b", builder, "-d", dest / "doctrees", "-wtest.txt"] if debug: # Disable parallel builds and show exceptions in debug mode. diff --git a/test_update_fls.sh b/test_update_fls.sh new file mode 100755 index 0000000..06c9cff --- /dev/null +++ b/test_update_fls.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +./make.py +if [ $? -eq "0" ];then + echo "FLS is up to date" + exit 0 # No error, no update required +else + grep -q "ERROR: The FLS specification has changed since the lock file was created:" test.txt + OUTOFDATE=$? + grep -q "Found differences between live FLS data and lock file affecting 0 guidelines" test.txt + ZEROAFFECTED=$? + + if [ $OUTOFDATE -eq "0" ]; then + if [ $ZEROAFFECTED -eq "0" ]; then + ./make.py --update-spec-lock-file + rm test.txt + exit 1 # Can be updated automatically + else + ./make.py --update-spec-lock-file + rm test.txt + exit 2 # Guidelines need human review + fi + fi +fi + +rm test.txt +exit 3 # Other build error not related to FLS