1name: Verify code formatting 2on: 3 push: 4 pull_request: 5 6jobs: 7 verify-formatting: 8 runs-on: ubuntu-latest 9 steps: 10 - name: Checkout 11 uses: actions/checkout@v2 12 with: 13 persist-credentials: false 14 fetch-depth: 0 15 - name: Install astyle 16 run: | 17 sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse" 18 sudo apt-get update -y -qq 19 sudo apt-get install astyle 20 - name: Format code 21 run: python code-format.py 22 working-directory: scripts 23 - name: Check that repository is clean 24 shell: bash 25 run: | 26 set -o pipefail 27 if ! (git diff --exit-code --color=always | tee /tmp/lvgl_diff.patch); then 28 echo "Please apply the preceding diff to your code or run scripts/code-format.py" 29 exit 1 30 fi 31 - name: Comment PR 32 uses: thollander/actions-comment-pull-request@v1 33 if: github.event_name == 'pull_request' && failure() 34 with: 35 message: | 36 Your PR needs its formatting corrected before it can be merged upstream. 37 38 Please run `scripts/code-format.py` and commit the resulting change. 39 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 40