V1.13.9 Updates #421
Workflow file for this run
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: Run clang-format | |
on: | |
pull_request_target: | |
branches: | |
- '*' | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
outputs: | |
status: ${{ steps.early.conclusion }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
- uses: DoozyX/clang-format-lint-action@v0.18.1 | |
with: | |
source: '. ./src ./src/libs' | |
exclude: './src/libs/TimerInterrupt ./scripts ./src/fonts128x64.h' | |
extensions: 'c,cpp,h,hpp' | |
clangFormatVersion: 12 | |
inplace: True | |
- name: Check if diff | |
id: needs_work | |
run: if git diff --quiet --exit-code; then exit 0; else exit 1; fi | |
continue-on-error: true | |
- name: Create patch | |
if: ${{ steps.needs_work.outcome != 'success' }} | |
run: git diff > ./clang-format-diff.patch | |
- uses: actions/upload-artifact@v4 | |
if: ${{ steps.needs_work.outcome != 'success' }} | |
with: | |
name: clang-format-diff.patch | |
path: ./clang-format-diff.patch | |
- uses: mshick/add-pr-comment@v1 | |
if: ${{ steps.needs_work.outcome != 'success' }} | |
with: | |
message: | | |
Looks like your PR has code that needs to be changed in order to meet our coding standards! | |
Here are your options: | |
1. Apply the patch that was generated by the job | |
1. Click `details` under the failing clang-format check | |
1. Click the `Artifacts` dropdown in the top right | |
1. Download + unzip the `clang-format-diff.patch` file into the `OpenAstroTracker-Firmware` repo | |
1. Run `git apply clang-format-diff.patch` to make the changes | |
1. Commit and push up the formatted code | |
1. Run `clang-format` locally | |
1. Run the command `bash -c 'shopt -s nullglob globstar;GLOBIGNORE=./src/libs/TimerInterrupt/*; for i in ./{.,src/**,unit_tests,boards/**}/*.{c,cpp,h,hpp}; do clang-format -i $i; done'` | |
1. Commit and push up the formatted code | |
repo-token: ${{secrets.BOT_ACCESS_TOKEN}} | |
repo-token-user-login: 'openastrotech-bot' | |
allow-repeats: false | |
- name: Fail if needs formatting | |
if: ${{ steps.needs_work.outcome != 'success' }} | |
run: if git diff --quiet --exit-code; then exit 0; else exit 1; fi |