-
Notifications
You must be signed in to change notification settings - Fork 115
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
Add a script to check for various inclusion criterias #446
Conversation
Thanks for taking the time! |
# No "archived" status on Bitbucket: https://jira.atlassian.com/browse/BCLOUD-18018 | ||
ARCHIVED="false" | ||
elif [[ "$REPOSITORY" == *"gitlab.com"* ]]; then | ||
DATA=$(curl -s -H "Accept:application/json" -H "Authorization: Bearer $GITLAB_TOKEN" "https://gitlab.com/api/v4/projects/$ENCODED_OWNER_REPO") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like we need auth for this? https://docs.gitlab.com/ee/api/projects.html#get-a-single-project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately an authenticated call to the Gitlab API only returns a fraction of the project fields and archived
is not part of it.
It's not well described in their doc, you juste have a brief explanation of it in https://docs.gitlab.com/ee/api/projects.html#list-all-projects where they talk about
When simple=true or the user is unauthenticated this returns something like:
ENCODED_OWNER_REPO="${OWNER_REPO//\//%2F}" | ||
|
||
if [[ "$REPOSITORY" == *"github.com"* ]]; then | ||
DATA=$(curl -s -H "Accept:application/json" -H "Authorization: Bearer $GITHUB_TOKEN" "https://api.github.com/repos/$OWNER_REPO") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, we don't need a token for public repositories: https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#get-a-repository
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately we need it, there's a rate limit of 60 api calls for unauthenticated users https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#primary-rate-limit-for-unauthenticated-users
As promised almost 3 months ago, here's a script that checks for the following criterias for the existing crates listed on the repo:
I also added back crates I previously removed by error and cleaned existing ones that did not meet the above criterias.
Please note that I am by no means any good in bash scripting so I did my very best here and probably spent too much time writing those lines.
As a future addition in another PR, we can add the check to the last criteria (
"The package is not flagged as unmaintained in the Rust security advisory database"
) to clean some crates that have gone unmaintained for many years.