# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions # Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners name: format on: push: branches: - 'master' - 'releases/**' - '1.*' tags: - '1.*' pull_request: permissions: contents: read jobs: format: runs-on: ubuntu-22.04 defaults: run: shell: bash -euo pipefail {0} env: UNCRUSTIFY_INSTALL_DIR: ${{ github.workspace }}/runformat-uncrustify steps: - uses: actions/checkout@v6 with: persist-credentials: false - name: Determine uncrustify version id: get-uncrustify-version run: | version="$(./runformat --expected-uncrustify-version)" echo "Expected uncrustify version: $version" echo "version=$version" >> "$GITHUB_OUTPUT" - name: Set UNCRUSTIFY_VERSION env variable run: | version=$(./runformat --expected-uncrustify-version) echo "version [$version]" echo "UNCRUSTIFY_VERSION=${version}" >> "$GITHUB_ENV" - name: Cache uncrustify uses: actions/cache@v4 id: cache-uncrustify with: path: ${{ env.UNCRUSTIFY_INSTALL_DIR }} key: ${{ runner.os }}-uncrustify-${{ steps.get-uncrustify-version.outputs.version }} - name: Install uncrustify if: steps.cache-uncrustify.outputs.cache-hit != 'true' run: | ./runformat --install --install-dir "${UNCRUSTIFY_INSTALL_DIR}" - name: Uncrustify check run: | ./runformat