Skip to content

Commit

Permalink
Merge pull request #88 from safedep/fix/pr-compare-commits-diverging-…
Browse files Browse the repository at this point in the history
…branches

fix: Avoid throwing when head and base are diverged
  • Loading branch information
abhisek authored Nov 5, 2024
2 parents 67815d8 + eb9966f commit 3a47cf6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/vet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,13 @@ export class Vet {
throw new Error(`Unable to get changed files: ${response.status}`)
}

// This is a valid case and happen frequently during development.
// We should not expect that head is always ahead of base. The side effect
// of this choice is, we may end up raising an issue that already exists
// in the base branch due to divergence. This is acceptable because even
// GitHub PR diff viewer shows the same in case of divergence.
if (response.data.status !== 'ahead') {
throw new Error(`Head is not ahead of Base: ${response.data.status}`)
core.info(`Head is not ahead of Base: ${response.data.status}`)
}

if (!response.data.files) {
Expand Down

0 comments on commit 3a47cf6

Please sign in to comment.