Skip to content

Format and Commit

Format and Commit #44

Workflow file for this run

name: Format and Commit
on: workflow_dispatch
jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- name: Code checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get origin/master base ref
id: get-base-sha
run: |
echo "base_sha=$(git rev-parse "$(git merge-base origin/master "$(git rev-parse --abbrev-ref HEAD )")") >> $GITHUB_OUTPUT"
- name: Get changed files from origin/master
id: changed-files
uses: tj-actions/changed-files@v41.0.0
with:
base_sha: ${{ steps.get-base-sha.outputs.base_sha }}
files_ignore: |
**/*.yml
.clang*
.git*
**/*.txt
**/*.sh
**/*.def
**/Makefile
makedefs
**/*.md
**/*.txt
**/.pylintrc
**/.gitignore
**/.git*
**/LICENSE
- name: Format changed files
uses: DoozyX/clang-format-lint-action@v0.17
if: steps.changed-files.outputs.any_changed == 'true'
with:
source: ${{ steps.changed-files.outputs.all_changed_files }}
extensions: 'h,c'
clangFormatVersion: 17
inplace: true
style: file
- uses: EndBug/add-and-commit@v9
with:
message: 'Committing clang-format changes'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}