Skip to content

Auto Format - 144/merge #753

Auto Format - 144/merge

Auto Format - 144/merge #753

Workflow file for this run

name: Auto Format
run-name: Auto Format - ${{ github.ref_name }}
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.run_id }}
cancel-in-progress: true
jobs:
clang:
name: Clang
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Pull Request
uses: actions/checkout@v6
with:
fetch-depth: 1
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.AUTOFORMAT_COMMIT_TOKEN || github.token }}
- name: Format C Files
run: |
set -o pipefail
echo "<details open><summary>Clang-Format Output</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
git ls-files '*.c' '*.h' | xargs -r clang-format -i --verbose 2>&1 | tee -a $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
- name: Save Changes
uses: EndBug/add-and-commit@v9
if: github.ref_type != 'tag'
env:
HOME: ${{ github.workspace }}
with:
default_author: github_actions
message: 'Automatic Clang-Format: Standardized formatting automatically'
fetch: 'false'
cmake:
name: CMake
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Pull Request
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.AUTOFORMAT_COMMIT_TOKEN || github.token }}
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install Gersemi
run: pip3 install gersemi
- name: Format CMake Files
run: gersemi --in-place ${{ github.workspace }}
- name: Save Changes
uses: EndBug/add-and-commit@v9
if: github.ref_type != 'tag'
env:
HOME: ${{ github.workspace }}
with:
default_author: github_actions
message: 'Automatic CMake Format: Standardized formatting automatically'
fetch: 'false'
json:
name: Json
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Pull Request
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.AUTOFORMAT_COMMIT_TOKEN || github.token }}
- name: Format JSON Files
run: |
set -o pipefail
git ls-files '*.json' | xargs -r -I{} sh -c 'jq --tab . {} > {}.tmp && mv {}.tmp {}'
- name: Save Changes
uses: EndBug/add-and-commit@v9
if: github.ref_type != 'tag'
env:
HOME: ${{ github.workspace }}
with:
default_author: github_actions
message: 'Automatic Json Format: Standardized formatting automatically'
fetch: 'false'
all:
name: Complete Auto Format
needs: [ clang, cmake, json ]
runs-on: ubuntu-slim
permissions: {}
steps:
- name: Complete Auto Format
run: |
echo "Auto Format has been completed for Clang, CMake, and JSON files."
echo "Please refer to the individual job logs for detailed formatting information."