From b88f9a4fc1eba7fd2362e077919fd4c82a493d8d Mon Sep 17 00:00:00 2001 From: James Grugett Date: Fri, 26 Aug 2022 23:56:38 -0500 Subject: [PATCH] Set up github action to remove unused imports --- .github/workflows/lint.yml | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..27a54149 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,43 @@ +name: Run linter (remove unused imports) + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + push: + branches: [main] + +env: + FORCE_COLOR: 3 + NEXT_TELEMETRY_DISABLED: 1 + +# mqp - i generated a personal token to use for these writes -- it's unclear +# why, but the default token didn't work, even when i gave it max permissions + +jobs: + lint: + name: Auto-lint + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + token: ${{ secrets.FORMATTER_ACCESS_TOKEN }} + - name: Restore cached node_modules + uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }} + - name: Install missing dependencies + run: yarn install --prefer-offline --frozen-lockfile + - name: Run lint script + run: yarn lint + - name: Commit any lint changes + if: always() + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Auto-remove unused imports + branch: ${{ github.head_ref }}