Skip to content

Commit 51fc7b9

Browse files
authored
Add automated job to fix snapshots (#2804)
1 parent e8529c7 commit 51fc7b9

File tree

2 files changed

+35
-22
lines changed

2 files changed

+35
-22
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,34 +30,20 @@ jobs:
3030
with:
3131
node-version: ${{ matrix.node-version }}
3232
- run: npm install
33-
- run: npx ava
34-
lint-test:
35-
runs-on: ${{ matrix.os }}
36-
strategy:
37-
matrix:
38-
os:
39-
- ubuntu-latest
40-
- windows-latest
41-
steps:
42-
- uses: actions/checkout@v4
43-
- uses: actions/setup-node@v4
44-
with:
45-
# Locked due to the difference of `zlib.gzipSync()` between Node.js versions
46-
node-version: 24
47-
- run: npm install
48-
- run: npm run lint
49-
- run: npx del-cli test/snapshots --verbose
50-
# Force update snapshots, https://github.com/avajs/ava/discussions/2754
51-
- run: npx c8 ava --update-snapshots
52-
env:
53-
AVA_FORCE_CI: not-ci
54-
- run: git diff --exit-code
33+
- run: npx c8 ava
5534
- uses: codecov/codecov-action@v5
5635
with:
5736
fail_ci_if_error: true
5837
disable_search: true
5938
files: coverage/lcov.info
6039
token: ${{ secrets.CODECOV_TOKEN }}
40+
lint:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: actions/setup-node@v4
45+
- run: npm install
46+
- run: npm run lint
6147
run-rules-on-codebase:
6248
runs-on: ubuntu-latest
6349
steps:
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: autofix.ci # needed to securely identify the workflow
2+
on:
3+
pull_request:
4+
permissions: {}
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
jobs:
9+
update-snapshots:
10+
if: github.repository == 'sindresorhus/eslint-plugin-unicorn'
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
# Locked due to the difference of `zlib.gzipSync()` between Node.js versions
17+
node-version: 24
18+
- run: npm install
19+
- run: npm run lint
20+
- run: rm -rf test/snapshots
21+
# Force update snapshots, https://github.com/avajs/ava/discussions/2754
22+
- run: npx c8 ava --update-snapshots
23+
env:
24+
AVA_FORCE_CI: not-ci
25+
- uses: autofix-ci/action@v1
26+
with:
27+
commit-message: "Update snapshots"

0 commit comments

Comments
 (0)