Giter Site home page Giter Site logo

getsentry / action-eslint-fix Goto Github PK

View Code? Open in Web Editor NEW
20.0 3.0 4.0 713 KB

GitHub Action to run `eslint` with `--fix` option and commit fixes

License: MIT License

TypeScript 94.58% JavaScript 5.42%
eslint javascript github-actions github-actions-javascript tag-archived

action-eslint-fix's People

Contributors

billyvg avatar dependabot[bot] avatar thisismissem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

action-eslint-fix's Issues

Parameter token or opts.auth is required

Getting the following error when running the action. Any idea what's missing?

Run getsentry/action-eslint-fix@019e40047bc28cbe8c2c12073d37365737182ad4
  with:
    dry: false
  env:
    GITHUB_TOKEN: ***
Error: Parameter token or opts.auth is required

code -

name: Automatic Lint Fixes
on:
  issue_comment:
    types:
      - created
jobs:
  eslint:
    name: eslint
    if: github.event.issue.pull_request && github.event.comment.body == '/eslint'
    runs-on: ubuntu-20.04
    steps:
      - name: Automatic Lint Fix
        uses: getsentry/action-eslint-fix@019e40047bc28cbe8c2c12073d37365737182ad4
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Seeing an issue with git diff

Using as per the README:

https://github.com/tuxcanfly/hsd/blob/732cbff843c490f8bb265f5bf29ccd4eeb769c05/.github/workflows/node.js.yml#L32-L35

Run getsentry/action-eslint-fix@v1
/usr/bin/git diff-tree --diff-filter=d --no-commit-id --name-only -r 1c03b8894ada39b63e7d519121d73aca146c0461 4219b3c8d21b0bb64430a868b424cae5684d58c0
fatal: bad object 1c03b8894ada39b63e7d519121d73aca146c0461
##[error]fatal: bad object 1c03b8894ada39b63e7d519121d73aca146c0461

Tests run from my PR which integrates this, but seems like it's failing at eslint step. Not sure why ๐Ÿค”

What am I missing?

Action doesn't commit fixes

Environment

ubuntu-latest

How do you use Sentry? No
Sentry SaaS (sentry.io) or self-hosted/on-premise (which version?)

Which SDK and version?
e.g: JavaScript 5.11.1, .NET 1.2.0

Steps to Reproduce

  1. Prepare a small Vue-Typscript project scaffold. Mine's here
  2. Create a few javascript functions. Put extra semicolons in some code to trigger an automatic fix by eslint.
  3. Create a github action like below. Mine's here:
  lintFix:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Install modules
      run: npm install
    - name: Use current action
      uses: getsentry/action-eslint-fix@v1
      with:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expected Result

"style(): Auto eslint fix" to appear in the commit history for my PR

Actual Result

None

What actually happened. Maybe a screenshot/recording? Maybe some logs?
No error. Everything went smoothly in the logs

Error: Cannot read property "number" of undefined

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! ๐Ÿ™‚

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.