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

[bfix] Calculates and logs rate-limit #8

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

Riyabelle25
Copy link
Collaborator

Solves #5
Calculates and logs Rate-Limit using the GitHub API, making use of async-await

.github/workflows/main.yml Outdated Show resolved Hide resolved
.github/workflows/main.yml Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
index.js Show resolved Hide resolved
index.js Outdated
const getRateLimit = await rateLimit();
console.log(getRateLimit.data.rate);
const writeOSSF = async () => {
repoOSSF[repository] = await output.slice(17).replace('\n', '');
Copy link
Owner

Choose a reason for hiding this comment

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

what's the magic 17 for?

also, this only replaces one newline; is that intended?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The 17 slices the output string to get the Aggregate Score value for each repo from it. And similarly replacing the newlines iteratively is needed to get the score properly

Copy link
Owner

Choose a reason for hiding this comment

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

It might be clearer to use the actual string with .length rather than 17 :-)

Sounds good on the newlines - probably some text fixtures would make this clearer also.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did not understand, how can we splice the output string with .length?

index.js Outdated Show resolved Hide resolved
@Riyabelle25
Copy link
Collaborator Author

Riyabelle25 commented Apr 19, 2022

I'm not sure why the pretest and posttest actions keep failing. I'd simply resued them over from repo-report, as you'd suggested :(

@ljharb
Copy link
Owner

ljharb commented Apr 20, 2022

Try npm install --save-dev aud

@Riyabelle25 Riyabelle25 changed the title Calculates and logs Rate-Limit [bfix] calculates and logs rate-limit Apr 20, 2022
@Riyabelle25 Riyabelle25 changed the title [bfix] calculates and logs rate-limit [bfix] Calculates and logs rate-limit Apr 20, 2022
@ljharb
Copy link
Owner

ljharb commented Apr 22, 2022

@Riyabelle25 i rebased this but there's basically nothing left in it. Could you repurpose it to continue the rate limiting work?

@ljharb ljharb marked this pull request as draft April 22, 2022 20:22
@Riyabelle25
Copy link
Collaborator Author

@ljharb apologies for the long gap of silence. Had end of term examinations followed by a long period of bothersome illness 😞
Yes, this PR will be re-purposed to implement the rate-limit threshold. I'll open another issue shortly, and edit this PR

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.

None yet

2 participants