public-js/eslint-plugin-node

View on GitHub
.github/workflows/lint.yml

Summary

Maintainability
Test Coverage
name: Lint

on:
  pull_request:
    branches:
      - main
  push:
    branches:
      - main
      - '!release/**'

env:
  IS_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
  IS_DBOT: ${{ github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]' }}
  IS_MAIN: ${{ github.ref == 'refs/heads/main' }}

jobs:
  lint:
    name: Lint code
    runs-on: ubuntu-latest
    steps:
      - name: Checkout origin repo
        if: ${{ env.IS_FORK == 'false' && env.IS_DBOT == 'false' }}
        uses: actions/checkout@v3
        with:
          ref: ${{ github.head_ref }}
          token: ${{ secrets.BM_GITHUB_PAT }}
          fetch-depth: 2
      - name: Checkout forked repo
        if: ${{ env.IS_FORK == 'true' || env.IS_DBOT == 'true' }}
        uses: actions/checkout@v3
        with:
          fetch-depth: 2

      - name: Setup Node.js and cache
        uses: ./.github/actions/nodejs

      #- name: Typecheck
      #  run: npm run typecheck

      #- name: Lint-fix for manual internal PRs
      #  if: ${{ env.IS_FORK == 'false' && env.IS_MAIN == 'false' && env.IS_DBOT == 'false' }}
      #  run: |
      #    npm run ci:space:format -- --write
      #    TIMING=1 npm run ci:root:lint -- --fix
      #    TIMING=1 npm run ci:all:lint -- --fix

      - name: Lint-check #for auto PRs, forks or main branch
        #if: ${{ env.IS_FORK == 'true' || env.IS_MAIN == 'true' || env.IS_DBOT == 'true' }}
        run: |
          npm run ci:space:format -- --check
          npm run ci:root:lint
          npm run ci:all:lint

      #- name: Import GPG key
      #  uses: crazy-max/ghaction-import-gpg@v4
      #  if: ${{ env.IS_MAIN == 'false' && env.IS_FORK == 'false' && env.IS_DBOT == 'false' }}
      #  with:
      #    gpg_private_key: ${{ secrets.BM_GPG_PRIVATE }}
      #    passphrase: ${{ secrets.BM_GPG_PASS }}
      #    git_user_signingkey: true
      #    git_commit_gpgsign: true

      #- name: Get last commit message
      #  if: ${{ env.IS_MAIN == 'false' && env.IS_FORK == 'false' && env.IS_DBOT == 'false' }}
      #  id: last-commit-message
      #  run: echo "::set-output name=msg::$(git log -1 --pretty=%s)"

      #- name: Commit changes after linting
      #  uses: stefanzweifel/git-auto-commit-action@v4
      #  if: ${{ env.IS_MAIN == 'false' && env.IS_FORK == 'false' && env.IS_DBOT == 'false' }}
      #  with:
      #    commit_message: ${{ steps.last-commit-message.outputs.msg }}
      #    #commit_options: '--amend --no-edit --no-verify'
      #    commit_options: '--no-verify'
      #    commit_user_name: 'Blue Muffin'
      #    commit_user_email: '69810118+blue-muffin@users.noreply.github.com'
      #    commit_author: 'Blue Muffin <69810118+blue-muffin@users.noreply.github.com>'
      #    status_options: '--untracked-files=no'
      #    push_options: '--force-with-lease'
      #    skip_fetch: true

concurrency:
  group: lint-${{ github.head_ref }}
  cancel-in-progress: true