Skip to content

Sync isogram tests #553

Sync isogram tests

Sync isogram tests #553

name: "Verify C++ code formatting"
on:
push:
paths:
- "**/*.cpp"
- "**/*.h"
- "**/*.hpp"
- ".clang-format"
- "!**/catch.hpp"
pull_request:
paths:
- "**/*.cpp"
- "**/*.h"
- "**/*.hpp"
- ".clang-format"
- "!**/catch.hpp"
jobs:
verify-code-formatting:
runs-on: [ubuntu-22.04]
steps:
- name: "Checkout code"
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
- name: "Verify formatting of all files"
if: github.ref == 'refs/heads/master'
run: |
find . -type f \( -iname '*.cpp' -o -iname '*.h' -o -iname '*.hpp' \) -a ! -iname "catch.hpp" | \
xargs bin/check-formatting.sh
- name: "Verify formatting of the PR's files"
if: github.ref != 'refs/heads/master' && github.event.pull_request.url
run: |
PULL_REQUEST_URL=$(jq -r ".pull_request.url" "$GITHUB_EVENT_PATH")
curl --url $"${PULL_REQUEST_URL}/files" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | \
jq -c '.[] | select(.status == "added" or .status == "modified") | select(.filename | match("(?<!catch)\\.(cpp|hpp|h)$")) | .filename' | \
xargs bin/check-formatting.sh