gitpod-io / contribute.dev

A list of cool open-source projects that you can contribute to with one click
https://contribute.dev
MIT License
80 stars 22 forks source link

yarn add-project is not working. #84

Closed nisarhassan12 closed 4 years ago

nisarhassan12 commented 4 years ago

I'm trying to add #83 via the add-project script.

image

nisarhassan12 commented 4 years ago

I have added the project manually and the stars are not displaying: image

jankeromnes commented 4 years ago

@nisarhassan12 Ah, indeed, sorry. I should have included the following hint in the error message.

The likely reason add-project failed for you is that you got rate-limited by GitHub's API. The solution is to use the API with a Personal Access Token. Here is how to configure it:

  1. Go to https://github.com/settings/tokens and generate a new token (e.g. call it "contribute.dev"). I think you don't need to grant it any scopes (no scopes = safer).

  2. Copy the generated token (don't lose it, I think it's only displayed once, but also don't share it publicly, because people can use it to login to GitHub as yourself).

  3. Create an environment variable called GITHUB_PAT in https://gitpod.io/settings/, and paste the token into the "value" field. For the repository pattern, you can use gitpod-io/contribute.dev to only set this variable in contribute.dev workspaces (safer).

Next time you open a contribute.dev workspace and try add-project, it should work. 👍

EDIT: By the way, if you're interested, here is the code in add-project that tries to detect a GITHUB_PAT variable, and uses it to authenticate GitHub API calls:

https://github.com/gitpod-io/contribute.dev/blob/826c741f990823a95632648b7676bb5603d39956/scripts/add-project.js#L79-L81

jankeromnes commented 4 years ago

I have added the project manually and the stars are not displaying:

This is likely a cache problem with shields.io (since this service receives many many requests, they need to heavily cache the most used badges -- so if you start using a new badge, it may be really slow to appear at first, but it should get better once it is properly cached by shields.io).

nisarhassan12 commented 4 years ago

Many Thanks! :pray: @jankeromnes for the brief explanation.