Skip to content

fix: xcontent in list #252

fix: xcontent in list

fix: xcontent in list #252

Workflow file for this run

name: Code Format
on:
pull_request:
paths:
- 'Growing*/**'
- 'Modules/**'
- 'Services/**'
- 'Package.swift'
permissions:
contents: write
jobs:
code-format:
name: Code Format
runs-on: macos-latest
if: ${{ github.actor != 'GIOSDK' }} # 禁止套娃
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GIOSDK_PAT }}
- name: Install clang-format
run: brew install clang-format
- name: Install swiftformat
run: swiftformat --version
- name: Code Format
run: |
git fetch
git diff --name-only --relative --diff-filter=ACMR origin/master HEAD \
| sed -E -n '
\%\.pbobjc\.% d
\%^GrowingTrackerCore/Thirdparty/% d
\%^Services/Compression/LZ4/% d
\%^Services/Database/FMDB/% d
\%^Services/WebSocket/% d
\%^(Growing|Modules/|Services/).*\.(h|hpp|c|cpp|m|mm)% p
' \
| xargs clang-format -i -style=file
git diff --name-only --relative --diff-filter=ACMR origin/master HEAD \
| sed -E -n '
\%\.pb\.% d
\%^(Growing|Modules/|Services/).*\.swift% p
\%Package.swift% p
' \
| xargs swiftformat
- name: Commit
run: |
if [[ $(git status) == *"nothing to commit"* ]]; then
echo "All Code formatted correctly."
else
git checkout ${{ github.head_ref }}
git config user.name GIOSDK
git config user.email [email protected]
git commit -am "style: code format"
git push origin ${{ github.head_ref }}
fi