Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Use RefUpdateRule in BranchProtection check #936

Merged
merged 1 commit into from
Aug 30, 2021
Merged

Conversation

azeemshaikh38
Copy link
Contributor

  • Please check if the PR fulfills these requirements
  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    Uses graphQL API refUpdateRule to access non-admin branch protection fields.

  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
    No.

@github-actions
Copy link

Integration tests success for ff8e507186ca8ca13d9c1f0c98d27c37fa663eef

@github-actions
Copy link

Integration tests success for be02e11d8352b29903a1c0022023302c34c18528

@github-actions
Copy link

Integration tests success for e9720b3b868f2b3603cccaa20e787da1100cf810

@github-actions
Copy link

Integration tests success for 743a2e97627b88d83633a899443819c5466cd5f6

}
handler.data = new(branchesData)
if err := handler.graphClient.Query(handler.ctx, handler.data, vars); err != nil {
handler.errSetup = sce.Create(sce.ErrScorecardInternal, fmt.Sprintf("githubv4.Query: %v", err))
Copy link
Contributor

Choose a reason for hiding this comment

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

since the repo implementation returns a ErrScorecardInternal, we can assume in the checks that errors from any repo.* functions can be returned as-is. Correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As of now, yes. But I think its best we don't keep this assumption. The sce.Err* errors should be returned by checks package. Internal packages like gtihubrepo should be free to return other internal errors.

Copy link
Contributor

Choose a reason for hiding this comment

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

if we add ErrScorecardInternal in checks and the repo does too, we end up with multiple ErrScorecardInternal wrapping one another. Is there a better way to do it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's file an issue for cleaning this up because I think as of today, there is no clear guideline. IMO, only checks and pkg packages of Scorecard should return these Internal errors.

Copy link
Contributor

Choose a reason for hiding this comment

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

there's one already #783

@@ -51,8 +51,8 @@ var _ = Describe("E2E TEST:CodeReview", func() {
Error: nil,
Score: checker.MaxResultScore,
NumberOfWarn: 0,
NumberOfInfo: 2,
NumberOfDebug: 30,
NumberOfInfo: 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

how about changing this tests to one of our test repos to avoid breaking? We can update it properly later.

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 would prefer leaving this in explicitly broken state so that we don't miss this when we are fixing e2e tests.

@github-actions
Copy link

Integration tests success for 0ff08238d7cada2a9920713c71083e4b611c77e2

@github-actions
Copy link

Integration tests success for 8fc9b044669508e6ff2bd29c88c959c081c55f2a

@github-actions
Copy link

Integration tests failure for e20d93b9dc1b7698209e00db5182ffdc19345172

@github-actions
Copy link

Integration tests success for 8cc59ee5d9598d33b0ba44d0334313c37128a89a

@azeemshaikh38 azeemshaikh38 merged commit 9a1978a into main Aug 30, 2021
@azeemshaikh38 azeemshaikh38 deleted the azeems/branches branch August 30, 2021 23:14
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.

4 participants