Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm trying to include openapi-changes in our GitHub Actions CI to detect breaking changes in pull requests. My approach to doing this was to take the number of commits made on a branch
n
(given bygithub.event.pull_request.commits
) and passingn+1
toopenapi-changes
via the--limit
flag.Problem
What I found was that the tool looks at the full local git history of the file, and uses the
--limit
flag to cut off aftern
commits. This leads to problems when a PR has10
commits, but none or only some changed the OpenAPI spec being checked.Approach
As a quick fix, this PR adds a
global-revisions
boolean flag, which is used to instructgit
to list the history between specific revisions (i.e.,HEAD~(n+1)..HEAD
).Alternative Approaches
I've seen #85 and I think the approach of passing
git
revisions directly makes a lot of sense. However, I think there's some ambiguity around how this should be implemented.git log
itself.All these are worth exploring, but I needed a quick win.