Skip to content

Commit

Permalink
Add linter test (#4)
Browse files Browse the repository at this point in the history
* Add linter test

* Update linter.yml to not reference scitokens

This was linter code I originally wrote for scitokens, and I didn't catch the reference to scitokens when I was adding it to lotman
  • Loading branch information
jhiemstrawisc authored Sep 20, 2023
1 parent af88921 commit 9c8214b
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Lint

# Linter Action documentation at https://github.com/marketplace/actions/lint-action

# 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.
# Because the github token used for authenticating this commit comes from the upstream repo (ie pelicanplatform/lotman), those linter changes will not be pushed
# 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.
# The linter does not have authorization to lint any code in the repo's .github/workflows/ directory.

# If the linter fails, the PR can still be completed, but none of the linter changes will be made.

on:
# push: # Can specify more circumstances under which to run the linter.
# branches: # Not specifying input to "branches:" causes the action to run on push for all branches.
push:
branches:
- main
# Trigger the workflow on pull request,
# but only for master
pull_request_target:
branches:
- main

permissions:
checks: write
contents: read
pull-requests: write

jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest

steps:
- name: Check out repository (push)
if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v3

- name: Check out repository (pull_request_target)
if: ${{ github.event_name == 'pull_request_target' }}
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Install ClangFormat
run: sudo apt-get install -y clang-format

- name: Run linters
uses: wearerequired/lint-action@v2
with:
github_token: ${{ secrets.github_token }} # For providing the commit authorization for the auto_fix feature
clang_format: true
clang_format_auto_fix: true
auto_fix: true
commit: false
continue_on_error: false
git_email: github.event.commits[0].author.name # Uses the author's git email instead of the default git email associated with the action ("[email protected]")
clang_format_args: -style=file # Any additional arguments for clang_format

- name: suggester / lint
uses: reviewdog/action-suggester@v1
with:
tool_name: lint

0 comments on commit 9c8214b

Please sign in to comment.