Closed KhatiaIvanova closed 1 year ago
"respect CoCs on a .github" repo does this mean that I needed to enable cocs property in metrics only?
@KhatiaIvanova https://docs.github.com/en/graphql/reference/objects#repository suggests that this info is indeed part of the graphql api?
@KhatiaIvanova https://docs.github.com/en/graphql/reference/objects#repository suggests that this info is indeed part of the graphql api?
@ljharb I think I was searching in the wrong API somehow. I will text you soon.
@ljharb
As I see it returns the object, but I guess we just need a boolean if it exist in repo or not right ? Should I consider it while implementation?
Actually i think we can make this even more useful by having the config support null
(i don't care), true
(any CoC is fine), or an array of strings that match the CoC keys github supports. That way, we can enforce "has a CoC", but we can also enforce "has one of these specific CoCs"
@ljharb We added Loading.... for issue 80 in this open pull request. it works
@ljharb we didn't remove the console as you requested yesterday. so you think this will be good or not?
@ljharb so do you mean we should open a separate PR for the loading logs? it's about issue #80
Yep! Ideally a single PR is only about a single conceptual change.
@ljharb IT WORKS!
Hello @KhatiaIvanova , did you add a test to this metric? if so can you help me in the test part of the Security policy metric?
@ljharb Hey Jordan can you see my last commit in this pr. it is about name of code of conduct and it works. Is there anything more I need to do here?
@KhatiaIvanova yes, i have a few unresolved comments, and there's still no test files in the PR
@ljharb where should I add test cases? in tests ->utils->mock file ? and what kind of test cases? Should I test on my personal projects? (if it is a case how should I add the code). If you have any examples in this project for that kind of test it will be helpful. I don't see any.
@KhatiaIvanova i think this PR needs the same kind of tests as https://github.com/ljharb/repo-report/pull/75#issuecomment-1093118109. There's existing fixtures in the generateDetailTable tests.
As for which repos to use, basically we'd ideally need to find three things: a repo with no CoC at all, a repo with a CoC in itself, and a repo with a CoC inherited from a .github repo - and then grab the API responses for all three, and save those in the fixtures file.
@ljharb I think I understood. I found two of your projects with a code of conduct and without. and updated generateDetailTable.js and mockRepositoriesData.json files.
Can you review?
@ljharb I think I updated
@ljharb updated
@KhatiaIvanova thanks! it was almost there; you can see the changes I made here (you'll want to delete and re-checkout your local branch)
However, running the actual repo-report CLI prints this error:
RequestError [HttpError]: Unknown error: {"data":null,"errors":[{"message":"Something went wrong while executing your query. This may be the result of a timeout, or it could be a GitHub bug. Please include `[REDACTED]` when reporting this issue."}]}
at $PWD/node_modules/@octokit/request/dist-node/index.js:86:21
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async getRepositories ($PWD/src/utils.js:125:20)
at async getRepositories ($PWD/src/getRepositories.js:89:35)
at async loadingIndicator ($PWD/src/loadingIndicator.js:10:10)
at async Object.detail [as handler] ($PWD/src/commands/detail.js:26:35) {
status: 502,
response: {
url: 'https://api.github.com/graphql',
status: 502,
headers: {
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset',
connection: 'close',
'content-type': 'application/json',
date: 'Tue, 19 Apr 2022 05:59:32 GMT',
server: 'GitHub.com',
'transfer-encoding': 'chunked',
vary: 'Accept-Encoding, Accept, X-Requested-With',
'x-github-request-id': '[REDACTED]'
},
data: { data: null, errors: [Array] }
},
request: {
method: 'POST',
url: 'https://api.github.com/graphql',
headers: {
accept: 'application/vnd.github.v3+json',
'user-agent': 'octokit-graphql.js/4.8.0 Node.js/17.8.0 (darwin; x64)',
authorization: 'token [REDACTED]',
'content-type': 'application/json; charset=utf-8'
},
body: '{"query":"query {\\n viewer {\\n\\trepositories(\\n\\t first: 100\\n\\t affiliations: [OWNER, ORGANIZATION_MEMBER, COLLABORATOR]\\n\\t \\n\\t isFork: false\\n\\t privacy: PUBLIC\\n\\t) {\\n\\t totalCount\\n\\t pageInfo {\\n\\t\\tendCursor\\n\\t\\thasNextPage\\n\\t}\\n\\tnodes {\\n\\t\\tname\\n\\t\\tnameWithOwner\\n\\t\\tdefaultBranchRef {\\n\\t\\t\\tname\\n\\t\\t\\tbranchProtectionRule {\\n\\t\\t\\t\\tallowsForcePushes\\n\\t\\t\\t\\tallowsDeletions\\n\\t\\t\\t\\tdismissesStaleReviews\\n\\t\\t\\t\\trequiredApprovingReviewCount\\n\\t\\t\\t\\trequiresApprovingReviews\\n\\t\\t\\t\\trequiresCodeOwnerReviews\\n\\t\\t\\t\\trequiresConversationResolution\\n\\t\\t\\t\\trestrictsPushes\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\tdeleteBranchOnMerge\\n\\t\\thasIssuesEnabled\\n\\t\\thasProjectsEnabled\\n\\t\\thasWikiEnabled\\n\\t\\tforkingAllowed\\n\\t\\tisArchived\\n\\t\\tautoMergeAllowed\\n\\t\\tisBlankIssuesEnabled\\n\\t\\tisFork\\n\\t\\tisPrivate\\n\\t\\tisSecurityPolicyEnabled\\n\\t\\tcodeOfConduct {\\n\\t\\t\\tname\\n\\t\\t}\\n\\t\\tisTemplate\\n\\t\\tlicenseInfo {\\n\\t\\t\\tname\\n\\t\\t}\\n\\t\\tmergeCommitAllowed\\n\\t\\towner {\\n\\t\\t\\tlogin\\n\\t\\t}\\n\\t\\trebaseMergeAllowed\\n\\t\\tsquashMergeAllowed\\n\\t\\tcreatedAt\\n\\t\\tupdatedAt\\n\\t\\tpushedAt\\n\\t\\tviewerHasStarred\\n\\t\\tviewerPermission\\n\\t\\tviewerSubscription\\n\\t }\\n\\t}\\n }\\n rateLimit {\\n\\tcost\\n\\tremaining\\n }\\n}\\n"}'
}
}
k, i've rebased and updated this, and tests pass - but when i actually run repo-report, i still get the same kind of error.
It's weird that the docs say it's CodeOfConduct
, but that the graphql errors when you do that - are you sure it's codeOfConduct
?
I rebased this, and tests continue to pass, but the actual runtime crashes.
I filed a GitHub ticket about it: https://support.github.com/ticket/personal/0/1869049 (nobody else will likely be able to see it, but that's for tracking)
Looks like it's just a poor implementation on Github's side. I'll merge this, and then add a commit that retries with a smaller page size when the query doesn't work.
Fixes #72