Giter VIP home page Giter VIP logo

pronto-ruby's Introduction

Your all-in-one ruby Pronto runner.

This GitHub Action runs Pronto runners on your Ruby project diffs and reports back with a GitHub Check Run.

check runs

annotations

Runners

The docker image of this Action includes the following Pronto Runners:

  • brakeman
  • bundler_audit
  • eslint_npm
  • fasterer
  • flay
  • poper (removed—no support for pronto 0.11)
  • rails_best_practices
  • rails_schema
  • rails_data_schema (removed—no support for pronto 0.11)
  • reek
  • rubocop
  • scss
  • yamllint
  • stylelint

Inputs

name description default
runners Space-separated list of pronto runners to run. Must be the preinstalled runners from the list above. rubocop
target The git target pronto will diff against (-c) origin/master

Secrets

A GitHub token is available by default when using actions, but you must include it in the env map for this Action to use when creating a check run.

Be sure to include the ENV variable in your job step:

- uses: adwerx/pronto-ruby
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

That's it!

Configuration

Pronto can be configured via the .pronto.yml configuration file in your repo.

Example

With the defaults (only rubocop):

name: Pronto

on:
  - push
  - pull_request

jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: git fetch origin master --depth=1
      - uses: adwerx/pronto-ruby@main # use a tag version here
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

With specific runners:

name: Pronto
# ...
      with:
        runners: >-
          rubocop rails_schema yamllint

With eslint_npm runner using locally installed eslint:

name: Pronto
# ...
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - run: git fetch origin master --depth=1
      - uses: actions/setup-node@v1
      - run: yarn install --ignore-optional --ignore-scripts --frozen-lockfile --non-interactive
      - uses: adwerx/pronto-ruby@main # use a tag version here
        with:
          runners: eslint_npm # ...
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Development / Contributions

See CONTRIBUTING.md

pronto-ruby's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar jbielick avatar mbajur avatar mllocs avatar saicheg avatar tdurieux avatar

Stargazers

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

Watchers

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

pronto-ruby's Issues

pronto-ruby -v 2.3.1 not reporting back

I've just added this Github Action to a Rails project and I saw that the reports aren't being "published" after running. I can see in the logs that there were issues, but nothing is available then in the "checks" tab.

Is there any configuration I'm missing?

I tried with and without specific runners, same problem.

LICENSE file is empty

The LICENSE file in this repo is empty. Is that just an oversight, or is the intention that this code is proprietary?

Issues with reek

Hey there!

I'm trying to add a reek step to pronto action but it gives me:

/usr/local/lib/ruby/site_ruby/2.5.0/rubygems/specification.rb:2302:in `raise_if_conflicts': Unable to activate reek-5.5.0, because parser-2.7.0.1 conflicts with parser (>= 2.5.0.0, != 2.5.1.1, < 2.7) (Gem::ConflictError)

You can check that here: https://github.com/mbajur/pronto-ruby-bug/pull/2/checks?check_run_id=372623270

Here is the repro PR you're a contributor in if needed: mbajur/pronto-ruby-bug#2

Thanks!

Fails at rubocop-performance

Wow, love this, and would love to use it, unfortunately when trying to set it up on private repo with the suggested setup I was getting this error:

/usr/local/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- rubocop-performance (LoadError)

Was wondering if you had some suggestions.

erb_lint support?

Thanks for the great workflow! I was looking to add erb_lint support, when I noticed that the pronto-erb_lint gem is already required in the Gemfile, and the changelog suggested that it was already supported a number of years ago.

I added erb_lint to the end of my config:

name: Pronto
on: [ pull_request ]
jobs:
  pronto:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
      statuses: write
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - uses: HeRoMo/[email protected]
        with:
          github_token: ${{ secrets.GNARBOT_TOKEN }}
          runner: rubocop brakeman rails_best_practices erb_lint
          formatters: text github_status github_pr_review

When I run it, I get this error:
Screen Shot 2022-07-26 at 8 32 04 PM

Strictly speaking, erb_lint isn't in the list of supported runners. However, it looks like it should work according to the Dockerfile. Is there any particular reason erb_lint isn't supported?

.pronto-bundler_audit.yml not loading

Hey there!

I'm trying to add one vulnerability to ignored list using .pronto-bundler_audit.yml config file recommended by pronto-bundler_audit authors, it's contents looks as follows:

Advisories:
  Ignore:
    - CVE-2015-9284

While running pronto locally using pronto run --runner bundler_audit ignores this vulnerability perfectly fine, github action seems to not be loading this file and raises a check fail for given vulnerability.

Any idea what's going on in here? If you want to reproduce that, just run this action on ruby repo with gem 'omniauth', '1.9.0' entry in Gemfile and the config file pasted above.

Thanks!

Dependabot - `403 - Resource not accessible by integration`

Hey!

I am trying to use this action and it all works great when i am the one who opens/pushes the changes. However, once dependabot is opening a PR, this action is always failing with:

Faraday::Error::ClientError.inherited called from /usr/local/bundle/gems/octokit-4.14.0/lib/octokit/middleware/follow_redirects.rb:14.
/runner/src/github_action_check_run_formatter.rb:[10](https://github.com/xxx/yyy/actions/runs/6343338290/job/17230992679?pr=506#step:8:11): warning: already initialized constant Pronto::Formatter::FORMATTERS
/usr/local/bundle/gems/pronto-0.10.0/lib/pronto/formatter/formatter.rb:13: warning: previous definition of FORMATTERS was here
/usr/local/bundle/gems/octokit-4.14.0/lib/octokit/response/raise_error.rb:16:in `on_complete': POST https://api.github.com/repos/xxx/yyy/check-runs: 403 - Resource not accessible by integration // See: https://docs.github.com/rest/checks/runs#create-a-check-run (Octokit::Forbidden)

I tried every single solution i've found on the internet to try to fix it but nothing worked. Including https://docs.github.com/en/code-security/code-scanning/troubleshooting-code-scanning/resource-not-accessible-by-integration

failed to parse revision specifier - Invalid pattern ''

I have a following action config:

name: Pronto

on:
  - pull_request

jobs:
  run:
    runs-on: ubuntu-latest
    permissions:
      checks: write
      contents: read
    steps:
    - uses: actions/checkout@v1
    - run: echo `git merge-base --fork-point dev`
    - run: echo `git merge-base --fork-point origin/dev`
    - run: echo `git merge-base --fork-point origin/master`
    - id: get_base
      run: echo ::set-output name=sha::`git merge-base HEAD origin/dev || git merge-base HEAD origin/master`

    - name: Run Pronto
      uses: adwerx/[email protected]
      with:
        target: ${{ steps.get_base.outputs.sha }}
        runners: >-
          rails_schema rails_data_schema
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

and it raises a following error:

/usr/local/bundle/gems/pronto-0.10.0/lib/pronto/git/repository.rb:87:in `merge_base': failed to parse revision specifier - Invalid pattern '' (Rugged::InvalidError)
	from /usr/local/bundle/gems/pronto-0.10.0/lib/pronto/git/repository.rb:87:in `merge_base'
	from /usr/local/bundle/gems/pronto-0.10.0/lib/pronto/git/repository.rb:17:in `diff'
	from /usr/local/bundle/gems/pronto-0.10.0/lib/pronto.rb:62:in `run'
	from /usr/local/bundle/gems/pronto-0.10.0/lib/pronto/cli.rb:66:in `block in run'
	from /usr/local/bundle/gems/pronto-0.10.0/lib/pronto/cli.rb:64:in `chdir'
	from /usr/local/bundle/gems/pronto-0.10.0/lib/pronto/cli.rb:64:in `run'
	from /usr/local/bundle/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-0.20.3/lib/thor/invocation.rb:[12](https://github.com/Cuseum/spotzer-cms/actions/runs/6392060242/job/17348571308?pr=2948#step:9:13)6:in `invoke_command'
	from /usr/local/bundle/gems/thor-0.[20](https://github.com/Cuseum/spotzer-cms/actions/runs/6392060242/job/17348571308?pr=2948#step:9:21).3/lib/thor.rb:387:in `dispatch'
	from /usr/local/bundle/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
	from /runner/pronto:41:in `block in <main>'
	from /runner/pronto:40:in `chdir'
	from /runner/pronto:40:in `<main>'

Any idea what can be done about it?

Different ESLint configurations and plugins

Hey @jbielick!

So after giving a deeper look at current eslint it appears you were right about supporting different plugins and configurations. It works OK for simple installations, but for more advanced installations it is missing support for some advanced configurations and installations.

At this moment I can think of 3 options right now of resolving this problem:

  1. Cherry-pick post popular configurations ( standart/google/airbnb ) and plugins ( TOP30 by number of starts ) and

  2. Allow people to have a list of their configurations/plugins to be listed in their package.json and run npm install against their package.json before running pronto lint. (See https://github.com/hallee/eslint-action/blob/master/lib/entrypoint.sh for reference )

  3. Get rid of eslint pronto runner and suggest people to use separate Github Action for that.

Personally myself would love to stick with #1 or #2, since it really like current solution and would like to keep everything under the same roof.

What are you thoughts over here?

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.