Giter VIP home page Giter VIP logo

Comments (20)

rdlugosz avatar rdlugosz commented on August 21, 2024 5

If you're here because you're seeing a Github Action failing with this error, you can pin your version of rugged to 1.6.3 by updating the Github Actions Integration example code as follows:

...
      - name: Setup pronto
        run: gem install rugged:1.6.3 pronto pronto-rubocop
...

from pronto.

cooljacob204 avatar cooljacob204 commented on August 21, 2024 1

@cooljacob204 can you try removing that git fetch ... after the actions/checkout step. Also try adding fetch depth of 0 on the checkout.

      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

No error with this version of the checkout step.

from pronto.

ashkulz avatar ashkulz commented on August 21, 2024

Is there a repository which can reproduce this? I have a fix in mind, but won't know if it works without reproducing it...

from pronto.

cooljacob204 avatar cooljacob204 commented on August 21, 2024

I have reproduced it in a pet project of mine: gcp-sargeras/gcp-sargeras.com#32

from pronto.

ashkulz avatar ashkulz commented on August 21, 2024

@cooljacob204 it's not failing for me:

git clone https://github.com/gcp-sargeras/gcp-sargeras.com.git
cd gcp-sargeras.com
git checkout rugged-test
gem install rubocop-rails pronto pronto-rubocop
pronto run -f text -c origin/main # gives no error
pronto run -f github_status text -c origin/main # fails with an error about status reporting, but has gone past the error in GH Actions

Do you know what I'm missing here?

from pronto.

cooljacob204 avatar cooljacob204 commented on August 21, 2024

@ashkulz I have been only able to reproduce it in a GitHub action, I also haven't been able to hit the error locally.

from pronto.

pbstriker38 avatar pbstriker38 commented on August 21, 2024

This is happening because Pronto.run is being called without a file which then causes the options being passed to repo.diff to be nil. The nil options are then passed to @repo.diff(merge_base, head, options)

Simple fix is to do this:

patches = @repo.diff(merge_base, head, options || {})

https://github.com/prontolabs/pronto/blob/v0.11.2/lib/pronto/cli.rb#L70
https://github.com/prontolabs/pronto/blob/v0.11.2/lib/pronto.rb#L59
https://github.com/prontolabs/pronto/blob/v0.11.2/lib/pronto.rb#L64
https://github.com/prontolabs/pronto/blob/v0.11.2/lib/pronto/git/repository.rb#L30
https://github.com/libgit2/rugged/blob/v1.7.1/lib/rugged/repository.rb#L114

from pronto.

pbstriker38 avatar pbstriker38 commented on August 21, 2024

And I think this is happening on that PR because the only file is a new file.

from pronto.

pbstriker38 avatar pbstriker38 commented on August 21, 2024

@cooljacob204 can you try removing that git fetch ... after the actions/checkout step. Also try adding fetch depth of 0 on the checkout.

      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

from pronto.

ashkulz avatar ashkulz commented on August 21, 2024

@pbstriker38 I had the same fix in mind (it's obvious) but wasn't sure this would be all. Let me try and see if the information you gave can help reproduce it.

from pronto.

pbstriker38 avatar pbstriker38 commented on August 21, 2024

Other option is to fail early if there is no file

from pronto.

pbstriker38 avatar pbstriker38 commented on August 21, 2024

@cooljacob204
Great. And you got that git fetch command from the README here?

https://github.com/prontolabs/pronto#github-actions-integration

I'm not sure why that fetch would even be necessary given that actions/checkout has a fetch-depth option. 0 means everything, but you can also provide a specific depth depending on your needs. A depth of 0 is a safe bet and is pretty fast even on large repos.

@ashkulz
The README and wiki should probably be updated to show the setup that is most likely to work for everyone. If someone wants to speed things up by doing a specific git fetch then that is an advanced use case that is up to them.

name: Pronto
on: [pull_request]

jobs:
  pronto:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
      - name: Setup pronto
        run: gem install pronto pronto-rubocop
      - name: Run Pronto
        env:
          PRONTO_PULL_REQUEST_ID: ${{ github.event.pull_request.number }}
          PRONTO_GITHUB_ACCESS_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
        run: pronto run -f github_status github_pr_review -c origin/${{ github.base_ref }}

from pronto.

cooljacob204 avatar cooljacob204 commented on August 21, 2024

And you got that git fetch command from the README here?

Yup.

from pronto.

Related Issues (20)

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.