Skip to content

Commit

Permalink
feat: ✨ Add badge
Browse files Browse the repository at this point in the history
  • Loading branch information
robvanderleek committed Dec 2, 2024
1 parent b03d04b commit 5ba1f05
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# codelimit-action

[![Checked with Code Limit](https://github.com/getcodelimit/codelimit-action/blob/_codelimit_reports/main/badge.svg)](https://github.com/getcodelimit/codelimit)

To run Code Limit on every push and before every merge to main, append it to your GH Action workflow:

```yaml
Expand Down Expand Up @@ -31,4 +33,4 @@ To upload the report to Code Limit, add the following step to your workflow:
with:
upload: true
token: ${{ secrets.GITHUB_TOKEN }}
```
```
24 changes: 12 additions & 12 deletions src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,18 @@ async function main() {
exitCode = await exec(filename, ['app', 'upload', '--token', token, slug, branch]);
}
}
// const doCheck = getInput('check') || true;
// if (doCheck && exitCode === 0) {
// const changedFiles = await getChangedFiles(token);
// console.log(`Number of files changed: ${changedFiles.length}`);
// if (changedFiles.length === 0) {
// console.log('No files changed, skipping Code Limit');
// } else {
// console.log('Running Code Limit...');
// exitCode = await exec(filename, ['check'].concat(changedFiles), {ignoreReturnCode: true});
// }
// }
// fs.unlinkSync(filename);
const doCheck = getInput('check') || true;
if (doCheck && exitCode === 0) {
const changedFiles = await getChangedFiles(token);
console.log(`Number of files changed: ${changedFiles.length}`);
if (changedFiles.length === 0) {
console.log('No files changed, skipping Code Limit');
} else {
console.log('Running Code Limit...');
exitCode = await exec(filename, ['check'].concat(changedFiles), {ignoreReturnCode: true});
}
}
fs.unlinkSync(filename);
console.log('Done!');
process.exit(exitCode);
}
Expand Down

0 comments on commit 5ba1f05

Please sign in to comment.