getsentry / action-eslint-fix

GitHub Action to run `eslint` with `--fix` option and commit fixes
MIT License
20 stars 4 forks source link

Error: Cannot read property "number" of undefined #18

Open FxllenCode opened 2 years ago

FxllenCode commented 2 years ago

Steps to Reproduce

  1. Use provided code in a GitHub action in a codebase with an .eslintc.json
  2. Run the GitHub action
  3. Action fails; error logs "Error: Cannot read property "number" of undefined"

    Expected Result

The action succeeds as intended.

Actual Result

Specifically on that section of the action, the logs show:

Run getsentry/action-eslint-fix@v1

  with:
    GITHUB_TOKEN: ***
    dry: false
Error: Cannot read property 'number' of undefined

I'm not sure if the issue is code related or not - so here's a (snippet) of the workflow:


  deploy-dev:
    if: github.ref == 'refs/heads/dev' && github.event.head_commit.message != 'WIP'
    runs-on: ubuntu-latest
    steps:

      - name: Checkout
        uses: actions/checkout@v2

      - name: Update Submodules
        run: git submodule update --recursive --remote

      - name: Init new repo
        run: git init

      - name: Clone Submodules
        run: git clone https://github.com/Status-Plus/Status-Plus-Translation.git --recursive

      - uses: actions/checkout@v2

      - uses: actions/setup-node@v2
        with:
          node-version: '16'
      - run: npm install
      - run: npm run test

      - name: Use current action
        uses: getsentry/action-eslint-fix@v1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Caprover Deploy
        uses: AlexxNB/caprover-action@v1
        with:
          server: [REDACTED]
          password: [REDACTED]
          appname: [REDACTED]
          branch: 'dev'

      - uses: actions/checkout@v2
      - name: Create Sentry release
        uses: getsentry/action-release@v1
        env:
          SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
          SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
          SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
        with:
          environment: canary
          ignore_missing: true
          ignore_empty: true

Unsure if this is at all related or not - but thought I'd drop it here anyway.

Other Information

I wonder if it is related to the fact that I am running npm install earlier in the workflow? Not too sure, but it's possible this is causing it.

A feature that would be nice is slightly better error logging, I have no idea that this at all is related to!

Thanks! 🙂

deal-with-the-devil commented 2 years ago

I wonder if it is related to the fact that I am running npm install earlier in the workflow? Not too sure, but it's possible this is causing it.

I am not running npm install beforehand and see the same issue. Simple workflow for reference:

name: Lint

on: [push]

jobs:
  eslint:
    runs-on: ubuntu-latest
    steps:
      - name: Use current action
        uses: getsentry/action-eslint-fix@v1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}