Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@niwis
Copy link
Contributor

@niwis niwis commented Feb 13, 2025

  • Updated Unreleased section in CHANGELOG or it's not notable changes.

Reviewdog currently does not report anything for github-[pr-][check|annotate] reporters when triggered by pushing a commit.

Previously, diffs were not filtered when running reviewdog with github-[pr-][check|annotate] reporters on a non-PR (e.g. push commit).

if ch.req.PullRequest == 0 || ch.req.OutsideDiff {
// If it's not Pull Request run, do not filter results by diff regardless
// of the filter mode.
filterMode = filter.ModeNoFilter
}

This makes sense because when not executed on a PR, the DiffService is empty.
var ds reviewdog.DiffService = &reviewdog.EmptyDiff{}
if g.PullRequest != 0 {
ds = &githubservice.PullRequestDiffService{
Cli: client,
Owner: g.Owner,
Repo: g.Repo,
PR: g.PullRequest,
SHA: g.SHA,
FallBackToGitCLI: true,
}
}

However, 5e276ab changed the behaviour of reviewdog to always filter the diffs.

Restore the previous behaviour by setting opt.filterMode = filter.ModeNoFilter when running on a non-PR.

I think this might also resolve #1952

}
ds = ghDiffService
cs = reviewdog.MultiCommentService(checkService, cs)
case "github-pr-annotations":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you introduce "github-annotations" reporter, similar to github-check to github-pr-check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done. While doing so, I realized that github-check and github-pr-check are currently identical. I added a check that will fail if github-pr-[check|annotations] is run on a non-PR. Since this might be a breaking change, let me know if I should revert it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.
Can you revert the -pr checks?
Ideally, -pr-[check|annotations] reporters should be deprecated and everyone should use github-[check|annotations] for simplicity.
-pr-[check|annotations] reporters exists just for historical reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reverted the -pr checks. Let me know if I should do anything about the deprecation.

CHANGELOG.md Outdated

### :rocket: Enhancements
- ...
- [#2026](https://github.com/reviewdog/reviewdog/pull/2026) Add reporter for GitHub annotations `github-annotations`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you briefly mention it's the same as github-pr-annotations?
Ideally, we can also mention github-pr-annoations are deprecated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Same as `github-pr-annotations`, but also works for regular commits.
Throw an error when running `github-pr-[check|annotations` on non-PRs.
Make documentation more consistent.

Signed-off-by: Nils Wistoff <[email protected]>
Copy link
Member

@haya14busa haya14busa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work!

@haya14busa haya14busa merged commit 73ecb31 into reviewdog:master Feb 19, 2025
21 checks passed
@review-dog
Copy link
Member

Hi, @niwis! We merged your PR to reviewdog! 🐶
Thank you for your contribution! ✨

We just invited you to join the @reviewdog organization on GitHub.
Accept the invite by visiting https://github.com/orgs/reviewdog/invitation.
By joining the team, you'll be a part of reviewdog community and can help the maintenance of reviewdog.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No results when running reviewdog on push event in a GitHub action ?

3 participants