Skip to content

Commit 3187cae

Browse files
authored
Merge pull request #106 from jhiemstrawisc/linter
Add a Linter action to the GitHub workflow
2 parents 6d2490a + b2b2c01 commit 3187cae

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.clang-format

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BasedOnStyle: LLVM
2+
IndentWidth: 4

.github/workflows/linter.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Lint
2+
3+
# Linter Action documentation at https://github.com/marketplace/actions/lint-action
4+
5+
# One thing to note is that this action is currently configured automatically fix and re-push the linted code to the repo on a pull request.
6+
# Because the github token used for authenticating this commit comes from the upstream repo (ie scitokens/scitokens-cpp), those linter changes will not be pushed
7+
# to the fork that is providing the pull request. A manual git fetch will have to be run by the fork after the PR is merged to update the fork to the linted code.
8+
# The linter does not have authorization to lint any code in the repo's .github/workflows/ directory.
9+
10+
# If the linter fails, the PR can still be completed, but none of the linter changes will be made.
11+
12+
on:
13+
# push: # Can specify more circumstances under which to run the linter.
14+
# branches: # Not specifying input to "branches:" causes the action to run on push for all branches.
15+
16+
# Trigger the workflow on pull request,
17+
# but only for master
18+
pull_request:
19+
branches:
20+
- master
21+
22+
jobs:
23+
run-linters:
24+
name: Run linters
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- name: Check out Git repository
29+
uses: actions/checkout@v2
30+
31+
- name: Install ClangFormat
32+
run: sudo apt-get install -y clang-format
33+
34+
- name: Run linters
35+
uses: wearerequired/lint-action@v2
36+
with:
37+
github_token: ${{ secrets.github_token }} # For providing the commit authorization for the auto_fix feature
38+
clang_format: true
39+
clang_format_auto_fix: true
40+
auto_fix: true
41+
commit: true
42+
continue_on_error: false
43+
git_email: github.event.commits[0].author.name # Uses the author's git email instead of the default git email associated with the action ("lint-action@samuelmeuli.com")
44+
clang_format_args: -style=file # Any additional arguments for clang_format
45+
46+

0 commit comments

Comments
 (0)