Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support excludes #3

Merged
merged 7 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,18 @@ jobs:
- name: 'Run Code Limit'
uses: getcodelimit/codelimit-action@v1
```

## Excluding files

Use the input parameter `excludes` to exclude files and directories, this
action parameter takes a list of
[patterns](https://git-scm.com/docs/gitignore#_pattern_format).

```yaml
- name: 'Run Code Limit'
uses: getcodelimit/codelimit-action@v1
with:
excludes:
- examples
- third_party
```
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ inputs:
description: 'Checked changed files'
default: 'true'
required: false
excludes:
description: 'Extra exclude patterns to pass to Code Limit'
default: []
required: false
4 changes: 3 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49118,7 +49118,9 @@ function main() {
let exitCode = 0;
const clBinary = yield (0, codelimit_1.downloadCodeLimitBinary)();
console.log("Scanning codebase...");
yield (0, exec_1.exec)(clBinary, ["scan", "."]);
const excludes = (0, core_1.getMultilineInput)("excludes");
const excludeOpts = excludes.flatMap((e) => ["--exclude", e]);
yield (0, exec_1.exec)(clBinary, [...excludeOpts, "scan", "."]);
const markdownReport = yield generateMarkdownReport(clBinary);
const octokit = new action_1.Octokit({ auth: (0, core_1.getInput)("token") });
const doCheck = (0, core_1.getInput)("check") || true;
Expand Down
6 changes: 4 additions & 2 deletions src/action.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "fs";
import {getInput} from "@actions/core";
import {getInput, getMultilineInput} from "@actions/core";
import {context} from "@actions/github";
import {Octokit} from "@octokit/action";
import {
Expand Down Expand Up @@ -85,7 +85,9 @@ async function main() {
let exitCode = 0;
const clBinary = await downloadCodeLimitBinary();
console.log('Scanning codebase...');
await exec(clBinary, ['scan', '.']);
const excludes = getMultilineInput('excludes');
const excludeOpts = excludes.flatMap(e => ['--exclude', e]);
await exec(clBinary, [...excludeOpts, 'scan', '.']);
const markdownReport = await generateMarkdownReport(clBinary);
const octokit = new Octokit({auth: getInput('token')});
const doCheck = getInput('check') || true;
Expand Down
Loading