Skip to content

Commit

Permalink
improve script and test
Browse files Browse the repository at this point in the history
  • Loading branch information
mongolyy committed Dec 27, 2023
1 parent dcde085 commit b81c93b
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 26 deletions.
44 changes: 37 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,31 @@ jobs:
steps:
- uses: actions/checkout@v4
- id: action-success-test
name: action-success-test
uses: ./
with:
github_token: ${{ secrets.github_token }}
workdir: ./testdata
reporter: github-check
level: error
workdir: ./testdata
filter_mode: nofilter
fail_on_error: true
biome_flags: ok
- id: action-failure-test
name: action-failure-test
uses: ./
continue-on-error: true
with:
github_token: ${{ secrets.github_token }}
workdir: ./testdata
reporter: github-check
level: info
workdir: ./testdata
filter_mode: nofilter
fail_on_error: true
biome_flags: error
- name: check-failure
if: steps.action-failure-test.outcome == 'success'
run: exit 1

test-pr-check:
if: github.event_name == 'pull_request'
Expand All @@ -34,21 +44,31 @@ jobs:
steps:
- uses: actions/checkout@v4
- id: action-success-test
name: action-success-test
uses: ./
with:
github_token: ${{ secrets.github_token }}
workdir: ./testdata
reporter: github-pr-check
level: error
workdir: ./testdata
filter_mode: nofilter
fail_on_error: true
biome_flags: ok
- id: action-failure-test
name: action-failure-test
uses: ./
continue-on-error: true
with:
github_token: ${{ secrets.github_token }}
workdir: ./testdata
reporter: github-pr-check
level: info
workdir: ./testdata
filter_mode: nofilter
fail_on_error: true
biome_flags: error
- name: check-failure
if: steps.action-failure-test.outcome == 'success'
run: exit 1

test-pr-review:
if: github.event_name == 'pull_request'
Expand All @@ -57,18 +77,28 @@ jobs:
steps:
- uses: actions/checkout@v4
- id: action-success-test
name: action-success-test
uses: ./
with:
github_token: ${{ secrets.github_token }}
workdir: ./testdata
reporter: github-pr-review
level: error
workdir: ./testdata
filter_mode: nofilter
fail_on_error: true
biome_flags: ok
- id: action-failure-test
name: action-failure-test
uses: ./
continue-on-error: true
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-check
level: info
workdir: ./testdata
reporter: github-pr-review
level: info
filter_mode: nofilter
fail_on_error: true
biome_flags: error
- name: check-failure
if: steps.action-failure-test.outcome == 'success'
run: exit 1
10 changes: 5 additions & 5 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ fi
echo "Biome $("$(npm root)"/.bin/biome --version)"

echo '::group:: Running Biome with reviewdog 🐶 ...'
"$(npm root)"/.bin/biome ci "${INPUT_BIOME_FLAGS}" |
"$(npm root)"/.bin/biome ci "${INPUT_BIOME_FLAGS}" 2>&1 |
reviewdog \
-efm="%E%f:%l:%c %m ━%r" \
-efm="%C" \
-efm="%-Gci ━%#" \
-efm="%E%f:%l:%c %.%#━" \
-efm="%Z × %m" \
-efm="%E%f %m ━%r" \
-efm="%C" \
-efm="%E%f %m %.%#━" \
-efm="%Z × %m" \
-efm="%-G%.%#" \
-name="${INPUT_TOOL_NAME}" \
-reporter="${INPUT_REPORTER}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
-level="${INPUT_LEVEL}" \
${INPUT_REVIEWDOG_FLAGS}
"${INPUT_REVIEWDOG_FLAGS}"
exit_code=$?
echo '::endgroup::'
exit $exit_code
6 changes: 1 addition & 5 deletions testdata/error/format.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
let a = [,];
let b = [,,];
let c = [,,1,];
let d = [,,1,1];
let e = [2,2,1,3];
const a = [2,2,1,3];
6 changes: 1 addition & 5 deletions testdata/ok/format.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
let a = [,];
let b = [, ,];
let c = [, , 1];
let d = [, , 1, 1];
let e = [2, 2, 1, 3];
const a = [2, 2, 1, 3];
3 changes: 0 additions & 3 deletions testdata/ok/lint.js
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
[foo, bar] = baz;
[,,,b,,c,] = baz;
[a = "test", a.b, call().b] = baz;
[((a))] = baz;
2 changes: 1 addition & 1 deletion testdata/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b81c93b

Please sign in to comment.