2020-03-23 20:28:39 -07:00
|
|
|
# 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
|
2021-01-03 10:27:11 -08:00
|
|
|
runs-on: [ubuntu-20.04]
|
2020-03-23 20:28:39 -07:00
|
|
|
|
|
|
|
# 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: |
|
2020-03-24 10:09:29 -07:00
|
|
|
git fetch --no-tags --depth=1 origin ${{ github.base_ref }}:${{ github.base_ref }}
|
2020-03-23 20:28:39 -07:00
|
|
|
|
|
|
|
# Run the clang-format command (in $GITHUB_WORKSPACE, which is where the repo is checked out to)
|
|
|
|
- name: Run clang-format
|
2020-03-24 10:00:06 -07:00
|
|
|
run: ./scripts/clang-format.sh
|