Update patterns.py #167
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Clang-Format Workflow | |
on: | |
push: | |
branches: '**' | |
pull_request: | |
env: | |
LLVM_VERSION: 15 | |
jobs: | |
format: | |
name: Check the formatting | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Pin to a specific version | |
run: | | |
$latestChocoVersion = (Get-LatestChocoPackageVersion -TargetVersion $env:LLVM_VERSION -PackageName "llvm") | |
Choco-Install -PackageName llvm -ArgumentList '--allow-downgrade', '--version', $latestChocoVersion | |
- name: Run clang-format | |
env: | |
RED4EXT_COMMIT_BEFORE: ${{ github.event.pull_request.base.sha || github.event.before }} | |
RED4EXT_COMMIT_AFTER: ${{ github.sha }} | |
run: | | |
$output = (git ` | |
-c core.autocrlf=false ` | |
-c core.eol=lf ` | |
-c color.ui=always ` | |
clang-format ` | |
--style file ` | |
--diff $env:RED4EXT_COMMIT_BEFORE $env:RED4EXT_COMMIT_AFTER | |
)?.Trim() | |
Write-Output $output | |
# A temporary fix for https://github.com/llvm/llvm-project/issues/56736. | |
# TODO: Once LLVM 16 is released, reduce this to only the "git ... clang-format ..." command. | |
if ($LASTEXITCODE -eq 1 -and !$output) { | |
exit 0 | |
} |