--- # DESCRIPTION: Github actions config # SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 # name: format on: push: branches-ignore: - 'dependabot/**' # Avoid duplicates: only run the PR, not the push pull_request_target: workflow_dispatch: jobs: format: runs-on: ubuntu-24.04 name: Ubuntu 24.04 | format env: CI_OS_NAME: linux CI_RUNS_ON: ubuntu-24.04 steps: # Use the Verilator CI app to push formatting - this will trigger # workflows and consequently cancel in progress jobs if necessary - name: Generate access token if: ${{ github.repository == 'verilator/verilator' }} id: generate-token uses: actions/create-github-app-token@v2.1.4 with: app-id: ${{ vars.VERILATOR_CI_ID }} private-key: ${{ secrets.VERILATOR_CI_KEY }} permission-contents: write - name: Checkout uses: actions/checkout@v5 with: token: ${{ github.repository == 'verilator/verilator' && steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }} - name: Install packages for build env: CI_BUILD_STAGE_NAME: build run: | bash ci/ci-install.bash && sudo apt-get install clang-format-18 yapf3 && sudo pip3 install gersemi mbake && git config --global user.email "action@example.com" && git config --global user.name "github action" - name: Format code run: | autoconf && ./configure && make -j 2 format CLANGFORMAT=clang-format-18 && git status - name: Push run: |- if [ -n "$(git status --porcelain)" ]; then git commit . -m "Apply 'make format'" && git push origin fi