File: linter.yml

package info (click to toggle)
scitokens-cpp 1.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,172 kB
  • sloc: cpp: 11,717; ansic: 596; sh: 161; python: 132; makefile: 22
file content (64 lines) | stat: -rw-r--r-- 2,443 bytes parent folder | download | duplicates (2)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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 scitokens/scitokens-cpp), 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:
      - master
  # Trigger the workflow on pull request,
  # but only for master
  pull_request_target:
    branches:
      - master

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 ("lint-action@samuelmeuli.com")
          clang_format_args: -style=file # Any additional arguments for clang_format

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