Comments (20)
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 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.
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.
I have reproduced it in a pet project of mine: gcp-sargeras/gcp-sargeras.com#32
from pronto.
@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.
@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.
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.
And I think this is happening on that PR because the only file is a new file.
from pronto.
@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.
@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.
Other option is to fail early if there is no file
from pronto.
@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.
And you got that git fetch command from the README here?
Yup.
from pronto.
Related Issues (20)
- Request to move pronto-slim_lint runner repository into prontolabs HOT 2
- Validation failed 422 when pronto tries to comment on a Pull Request - pull_request_review_thread.diff_hunk HOT 1
- Problem with version 4.22 of octokit HOT 1
- Release new gem version HOT 2
- Pronto doesn't seem to compare files if they only changed file mode
- Relax Octokit version dependency HOT 1
- Could not find rake-13.0.1 in any of the sources (Bundler::GemNotFound)
- Upgrade rugged dependency for Ruby 3.2.0 - Dir.exists? is deprecated HOT 6
- config value 'safe.directory' was not found (Rugged::ConfigError) error after upgrade to 0.11.1 HOT 8
- merge_base: revspec 'master' not found (Rugged::ReferenceError) HOT 2
- Pronto restricting version of `chardet`
- Issue with comments not being created/posted with Github action workflow HOT 1
- Dotfiles are being ignored
- Metrics / analytics
- Handling comments that have been resolved HOT 1
- undefined method `[]' for nil:NilClass HOT 2
- Refactoring the way formatters are loaded to make easy to include custom formatter HOT 5
- Allow Octokit 8.0
- Failed to setup in GitLab CI HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pronto.