-
-
Notifications
You must be signed in to change notification settings - Fork 324
31 lines (29 loc) · 995 Bytes
/
format-code.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
name: format code
on:
pull_request:
paths:
- 'Sources/**'
- 'Tests/**'
- 'test-server/**'
- 'Samples/**'
- '.github/workflows/format-code.yml'
jobs:
# Formats Swift, Objective-C, C++, and C code and commits the formatted code
# if necessary
format-code:
name: Format Code
runs-on: macos-13
steps:
- uses: actions/checkout@v4
## Update internal list of formulae to the latest
- run: brew update
- name: Install Clang-Format
run: brew install clang-format
- run: swiftlint --version
- name: Format Code
run: make format
# actions/checkout fetches only a single commit in a detached HEAD state. Therefore
# we need to pass the current branch, otherwise we can't commit the changes.
# GITHUB_HEAD_REF is the name of the head branch. GitHub Actions only sets this for PRs.
- name: Commit Formatted Code
run: ./scripts/commit-formatted-code.sh $GITHUB_HEAD_REF