Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit 9866f27

Browse files
authored
feat(): Add dry option to run without committing changes (#9)
Sometimes you'd prefer tools to just tell you what's wrong, rather than automatically making changes and commits in your repository
1 parent d4c7d72 commit 9866f27

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,12 @@ Add the following to your workflow config
1414
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1515
```
1616
17+
If you would prefer this action to not modify files for you, use the following config:
18+
19+
```yaml
20+
- name: Use current action
21+
uses: getsentry/action-eslint-fix@v1
22+
with:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
dry: true
25+
```

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ inputs:
88
GITHUB_TOKEN:
99
description: 'GitHub token'
1010
required: true
11+
dry:
12+
description: Just runs eslint, doesn't commit any changes
13+
required: false
14+
default: false
1115
runs:
1216
using: 'node12'
1317
main: 'dist/index.js'

src/main.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {getChangedFiles} from './getChangedFiles'
99
async function run(): Promise<void> {
1010
try {
1111
const {owner, repo} = github.context.repo
12+
const dryRun = core.getInput('dry')
1213
const token = core.getInput('GITHUB_TOKEN')
1314

1415
if (!token) {
@@ -69,6 +70,10 @@ async function run(): Promise<void> {
6970
core.setFailed(err.message)
7071
}
7172

73+
if (dryRun) {
74+
return
75+
}
76+
7277
for (const result of results) {
7378
const filePath = result.filePath.replace(
7479
`${process.env.GITHUB_WORKSPACE}/`,

0 commit comments

Comments
 (0)