mirror of
https://github.com/bkaradzic/bgfx.cmake.git
synced 2026-02-17 21:12:35 +01:00
55 lines
1.9 KiB
YAML
55 lines
1.9 KiB
YAML
# https://github.com/openblack/bgfx.cmake/blob/master/.github/workflows/format.yml
|
|
name: Format
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request_target:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
cmake-format-check:
|
|
name: cmake-format
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
- name: Add base repo to git config
|
|
run: git remote add upstream ${{ github.event.pull_request.base.repo.html_url }}
|
|
if: startsWith(github.event_name, 'pull_request')
|
|
- name: Format CMake files
|
|
id: cmake-format
|
|
uses: PuneetMatharu/cmake-format-lint-action@main
|
|
with:
|
|
args: --config-files .cmake-format.py --check
|
|
# Run only if a PR and cmake-format has failed
|
|
cmake-format-action-suggester:
|
|
name: cmake-format fix suggester
|
|
runs-on: ubuntu-latest
|
|
needs: cmake-format-check
|
|
if: always() && startsWith(github.event_name, 'pull_request') && needs.cmake-format-check.result == 'failure'
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
- name: Add base repo to git config
|
|
run: git remote add upstream ${{ github.event.pull_request.base.repo.html_url }}
|
|
if: startsWith(github.event_name, 'pull_request')
|
|
- name: Format CMake files
|
|
id: cmake-format
|
|
uses: PuneetMatharu/cmake-format-lint-action@v1.0.0
|
|
with:
|
|
args: --config-files .cmake-format.py --in-place
|
|
- run: |
|
|
git diff > cmake-format.patch
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: formatting-fix-${{github.sha}}
|
|
path: cmake-format.patch
|
|
- uses: reviewdog/action-suggester@v1
|
|
with:
|
|
tool_name: cmake-format
|