Skip to content

Inputs and Outputs

These are the action inputs and outputs offered by cpp-linter-action.

Inputs

style

1.2.0 Default'llvm'

The style rules to use.

  • Set this to file to have clang-format use the closest relative .clang-format file.
  • Set this to a blank string ('') to disable the use of clang-format entirely.
  • Any code style supported by the specified version of clang-format.

extensions

1.2.0 Default'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx'

The file extensions to run the action against. This is a comma-separated string.

tidy-checks

1.2.0 Default'boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-*,cppcoreguidelines-*'

Comma-separated list of globs with optional - prefix. Globs are processed in order of appearance in the list. Globs without - prefix add checks with matching names to the set, globs with the - prefix remove checks with matching names from the set of enabled checks. This option's value is appended to the value of the 'Checks' option in a .clang-tidy file (if any).

  • It is possible to disable clang-tidy entirely by setting this option to '-*'.
  • It is also possible to rely solely on a .clang-tidy config file by specifying this option as a blank string ('').

repo-root

1.2.0 Default'.'

The relative path to the repository root directory. This path is relative to the path designated as the runner's GITHUB_WORKSPACE environment variable.

version

1.2.0 Default12

The desired version of the clang-tools to use. Accepted options are strings which can be 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8 or 7.

  • Set this option to a blank string ('') to use the platform's default installed version.
  • This value can also be a path to where the clang tools are installed (if using a custom install location).

verbosity

1.3.0 Default'info'

This controls the action's verbosity in the workflow's logs. Supported options are info or debug. This option does not affect the verbosity of resulting thread comments or file annotations.

The verbosity can also be engaged by enabling debug logs when re-running jobs or workflows.

lines-changed-only

1.5.0 Defaultfalse contents: read

This controls what part of the files are analyzed. The following values are accepted:

  • false: All lines in a file are analyzed.
  • true: Only lines in the diff that contain additions are analyzed.
  • diff: All lines in the diff are analyzed (including unchanged lines but not subtractions).

Important

This feature requires special permissions to perform successfully. See our documented permissions

files-changed-only

1.3.0 Defaulttrue contents: read

Set this option to false to analyze any source files in the repo. This is automatically enabled if lines-changed-only is enabled.

Important

This feature requires special permissions to perform successfully. See our documented permissions

ignore

1.3.0 Default'.github'

Set this option with string of path(s) to ignore.

  • In the case of multiple paths, you can use a pipe character (|) to separate the multiple paths. Multiple lines are forbidden as an input to this option; it must be a single string.
  • This can also have files, but the file's relative path has to be specified as well.
  • There is no need to use ./ for each entry; a blank string ('') represents the repo-root path.
  • Submodules are automatically ignored. Hidden directories (beginning with a .) are also ignored automatically.
  • Prefix a path with a bang (!) to make it explicitly not ignored. The order of multiple paths does not take precedence. The ! prefix can be applied to a submodule's path (if desired) but not hidden directories.
  • As of v2.12, glob patterns are supported here. All asterisk characters (*) were previously literal.

ignore-tidy

2.12.0 Default'.github'

Use this option to allow clang-tidy to ignore certain paths/files. See ignore for more details on possible values.

ignore-format

2.12.0 Default'.github'

Use this option to allow clang-format to ignore certain paths/files. See ignore for more details on possible values.

thread-comments

2.6.2 Default'false' contents: write

This controls the behavior of posted thread comments as feedback. The following options are supported:

  • true: enable the use of thread comments. This will always delete an outdated thread comment and post a new comment (triggering a notification for every comment).
  • update: update an existing thread comment if one already exists. This option does not trigger a new notification for every thread comment update.
  • false: disable the use of thread comments.

Important

This feature requires special permissions to perform successfully. See our documented permissions

Note

If run on a private repository, then this feature is disabled because the GitHub REST API behaves differently for thread comments on a private repository.

no-lgtm

2.6.2 Defaulttrue

Set this option to true or false to enable or disable the use of a thread comment or pull request review that basically says 'Looks Good To Me' (when all checks pass). The default value, true means no LGTM comment posted.

See thread-comments, tidy-review, and format-review options for further details.

step-summary

2.6.0 Defaultfalse

Set this option to true to append content as part of workflow's job summary.

See implementation details in GitHub's documentation about Adding a job summary. This option is independent of the thread-comments option, rather this option uses the same content that the thread-comments option would use.

Note

The no-lgtm option is not applied to step summaries.

file-annotations

1.4.3 Defaulttrue

Set this option to false to disable the use of file annotations as feedback.

database

1.4.0 Default''

The directory containing compilation database (like compile_commands.json) file.

extra-args

2.1.0 Default''

A string of extra arguments passed to clang-tidy for use as compiler arguments. Multiple arguments are separated by spaces so the argument name and value should use an = sign instead of a space.

Example

extra-args: '-std=c++17 -Wall'
This will be passed to clang-tidy as multiple --extra-arg options:
clang-tidy --extra-arg=-std=c++17 --extra-arg=-Wall

tidy-review

2.9.0 Defaultfalse experimental pull-requests: write

Set this option to true to enable Pull Request reviews from clang-tidy.

Important

This feature requires special permissions to perform successfully. See our documented permissions.

See also the PR review feature caveats.

Note

The no-lgtm option is applicable to Pull Request reviews.

format-review

2.9.0 Defaultfalse pull-requests: write

Set this option to true to enable Pull Request reviews from clang-format.

Important

This feature requires special permissions to perform successfully. See our documented permissions.

See also the PR review feature caveats.

Note

The no-lgtm option is applicable to Pull Request reviews.

passive-reviews

2.12.0 Defaultfalse pull-requests: write

Set this option to true to prevent Pull Request reviews from approving or requesting changes.

jobs

2.11.0 Default0

The number of jobs to run in parallel. If less than or equal to 0, the number of jobs is set to use the number of all available CPU cores.

Outputs

This action creates 3 output variables. Even if the linting checks fail for source files this action will still pass, but users' CI workflows can use this action's outputs to exit the workflow early if that is desired.

checks-failed

1.2.0

An integer that can be used as a boolean value to indicate if any checks failed by clang-tidy and clang-format.

clang-tidy-checks-failed

2.7.2

An integer that can be used as a boolean value to indicate if any checks failed by clang-tidy only.

clang-format-checks-failed

2.7.2

An integer that can be used as a boolean value to indicate if any checks failed by clang-format only.