pioneer/.github/workflows/clang-format.yml

38 lines
1.1 KiB
YAML

# Check all pull requests against the clang-format rules.
name: Clang Format
# Controls when the action will run.
# Run clang-format checks on all pull-requests
on:
pull_request:
paths:
- 'src/**.cpp'
- 'src/**.h'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
clang-format-check:
timeout-minutes: 5
# Ubuntu 18.04 at the time of writing includes clang-format-9 as default
runs-on: [ubuntu-20.04]
# We want to check all changed files between the pull-request base and the head of the pull request
env:
FORMAT_BASE: ${{ github.base_ref }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checkout the repository as $GITHUB_WORKSPACE
- uses: actions/checkout@v2
# Make sure to include the base we want to merge into
- run: |
git fetch --no-tags --depth=1 origin ${{ github.base_ref }}:${{ github.base_ref }}
# Run the clang-format command (in $GITHUB_WORKSPACE, which is where the repo is checked out to)
- name: Run clang-format
run: ./scripts/clang-format.sh