1
0
Fork 0

Check formatting in GitHub Actions

This commit is contained in:
Duncan Ogilvie 2025-11-20 00:18:03 +01:00
parent d2bd33cdeb
commit 0fa21ab247
1 changed files with 41 additions and 0 deletions

41
.github/workflows/format.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: Format
on:
push:
pull_request:
jobs:
format:
# Skip checking pull requests from the same repository
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }}
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Run Formatter
run: .github/format/AStyleHelper.exe Silent || true
- name: Check for Changes
id: check_changes
run: |
git diff --exit-code
continue-on-error: true
- name: Report Failure
if: steps.check_changes.outcome == 'failure'
run: |
echo "::error::Code is not formatted correctly! Please run 'format.bat' locally and commit the changes."
git diff --color
git diff > format.patch
exit 1
- name: Upload Patch
if: failure()
uses: actions/upload-artifact@v5
with:
name: format-patch
path: format.patch