diff --git a/.github/workflows/update-fls.yaml b/.github/workflows/update-fls.yaml new file mode 100644 index 00000000..44ee4eae --- /dev/null +++ b/.github/workflows/update-fls.yaml @@ -0,0 +1,28 @@ +name: Update FLS +on: + schedule: + - cron: "05 0 * * *" + workflow_dispatch: +env: + CAN_AUTOMATICALLY_UPDATE: false +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: Automatically update FLS if possible to do so + run: ./scripts/test_update_fls.sh + - name: Create Pull Request + if: env.CAN_AUTOMATICALLY_UPDATE == true + uses: peter-evans/create-pull-request@v7 + 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 a3201e0b..d935c02a 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/scripts/test_update_fls.sh b/scripts/test_update_fls.sh new file mode 100755 index 00000000..fe0707e9 --- /dev/null +++ b/scripts/test_update_fls.sh @@ -0,0 +1,28 @@ +#!/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 + echo 'true' >> "$CAN_AUTOMATICALLY_UPDATE" + 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