Ability to get per-commit changed files
- Dominant language
- TypeScript
- Stars
- 5.5k
- Forks
- 381
- Avg merge
- 2h 8m
- Merged PRs (30d)
- 6
Description
In ruby-danger I was able to get the list of files changed in each commit. in JS Danger that is no longer available nor is there a method to fetch that from github (or other system). We are trying to replace as much functionality we do in our ruby-danger with Peril and this is one feature we are currently unable to do.
Sample rule in our danger files today.
This rule will ensure that any changes to Gemfile, Gemfile.lock or somegem.gemspec are made in an isolated commit from non-gemfile changes.
We also have a similar rule that ensures all changes to Rails DB migrations and the associated schema.rb are in an isolated commit from other code changes (and prefixed with [migration]
```ruby
git.commits.each do |c|
short = " ( #{c.sha[0..7]} )"
has_gemfile_changes = c.diff_parent.any? {|f| f.path =~ /Gemfile/ || f.path =~ /gemspec/ }
has_gemfile_msg = c.message =~ /^\[gemfile\]/
if has_gemfile_changes
unless has_gemfile_msg
fail '[gemfile] Gemfile commits need to be prefixed with [gemfile] ' + short
end
if c.diff_parent.any? {|f| !( f.path =~ /Gemfile/ || f.path =~ /gemspec/ ) }
fail '[gemfile] Gemfile commit contains non-gemfile changes' + short
end
elsif has_gemfile_msg
fail '[gemfile] Gemfile commit has no gemfile changes!' + short
end
end
```
What I gather I need to do is add in a method to query the commit endpoint on github to fetch a specific commit (as that seems to be the only endpoint that will profile per-file information on the commit unless we use the V4 API)..
So, the question is where exactly should I add this functionality in the codebase so I can submit a PR?
Contributor guide
Research direction
The issue does not name a file, test, or entry point. Start by locating the GitHub commit endpoint integration and the existing commit representation in the TypeScript codebase, then check how the V4 API is handled. Done means JS Danger exposes each commit's changed-file list so rules such as the provided Gemfile and migration checks can use it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, typescript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100