From 21f31cfc16b99dc33cea5abad4f63c5523fbd0a0 Mon Sep 17 00:00:00 2001 From: Ashley Huo Date: Mon, 11 Dec 2023 11:52:20 -0500 Subject: [PATCH] add if condition and change node version --- .eslintrc.js | 2 +- .github/workflows/lint.yml | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 82eea28..072a33b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,4 +10,4 @@ module.exports = { // override/add rules settings here, such as: // 'vue/no-unused-vars': 'error' } -} \ No newline at end of file +} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1810a85..5c799c4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,7 +3,7 @@ name: Lint on: push: branches: - - main + - master pull_request: permissions: @@ -25,7 +25,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '14' + node-version: '20' - name: Install dependencies run: npm install @@ -34,7 +34,13 @@ jobs: run: | ./node_modules/.bin/eslint --ext .js,.vue src --fix - - uses: EndBug/add-and-commit@v9 + - name: Check if fixes were made + id: check-fixes + run: echo "::set-output name=has_fixes::$(git status --porcelain | grep -E '^(M| M)' | wc -l)" + + - name: Commit changes (if fixes were made) + if: steps.check-fixes.outputs.has_fixes > 0 + uses: EndBug/add-and-commit@v9 with: author_name: Lint Bot - message: 'Run linters' + message: 'Run linters' \ No newline at end of file