Skip to content

Commit

Permalink
feat: pr-test脚本eslint只检查js文件
Browse files Browse the repository at this point in the history
  • Loading branch information
Saraph1nes committed Jul 6, 2024
1 parent adc310b commit 8faef0a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
--jq '.files | .[] | select(.status|IN("added", "modified", "renamed", "copied", "changed")) | .filename')
echo "Changed files and operations: ${DIFF_DOCUMENTS}"
# Eslint 检查js文件
LINT_FILES=$(echo "${DIFF_DOCUMENTS}" | grep -E '^.*\.js$' | xargs)
echo "LINT_FILES=${LINT_FILES}" >> $GITHUB_ENV
# 忽略 .github/workflows 下的文件
GIT_DIFF_FILES=$(echo "${DIFF_DOCUMENTS}" | grep -vE '^\.github\/workflows\/.*' | xargs)
echo "GIT_DIFF_FILES=${GIT_DIFF_FILES}" >> $GITHUB_ENV
Expand Down Expand Up @@ -55,9 +59,9 @@ jobs:
cmd: install

- name: Lint Changed Files
if: ${{ env.GIT_DIFF_FILES }}
if: ${{ env.LINT_FILES }}
run: |
for file in ${{ env.GIT_DIFF_FILES }}; do
for file in ${{ env.LINT_FILES }}; do
yarn eslint "$file"
done
Expand Down

0 comments on commit 8faef0a

Please sign in to comment.