skops icon indicating copy to clipboard operation
skops copied to clipboard

Remove token from hub_utils.tests.common.py and move to secrets

Open adrinjalali opened this issue 2 years ago • 8 comments

We should remove the token from the repo and move it to secrets, but we should make sure it works on PRs from forks.

adrinjalali avatar Jul 21 '22 09:07 adrinjalali

@BenjaminBossan would you be up for this one?

merveenoyan avatar Aug 30 '22 12:08 merveenoyan

I would be up but I have no idea yet how to actually solve the problem.

BenjaminBossan avatar Aug 30 '22 12:08 BenjaminBossan

It's possible to have this work in PRs by doing some magic in GH actions, but then running the tests for users would require them to give a token. On the other hand, it's already the case that users would need to pass their token to create the docs. So maybe that's not a big issue?

adrinjalali avatar Aug 31 '22 07:08 adrinjalali

On the other hand, it's already the case that users would need to pass their token to create the docs

They could still use the checked in token for that.

running the tests for users would require them to give a token

I don't really see a good solution for that. We could mark all tests that require a valid token (which amounts to the network tests I guess) and if users don't provide a token, skip them. If they make changes that don't require those tests, then we're fine, else they have to provide their own token . At the end of the day, all tests will be run on CI.

BenjaminBossan avatar Aug 31 '22 09:08 BenjaminBossan

yeah I guess that works.

adrinjalali avatar Aug 31 '22 13:08 adrinjalali

Just noticed we also haven the token here. This one could really be replaced by a GH secret, though I guess we would also need to invalidate it since it's already public, and as long as we still use the same token for tests, nothing is gained.

BenjaminBossan avatar Dec 01 '22 13:12 BenjaminBossan

@BenjaminBossan AFAIK once you remove it on 🤗Hub it's invalidated. I think I don't have the user access to add tokens (I don't see the settings tab) maybe @adrinjalali can do it (and then we can replace the token with the secret).

merveenoyan avatar Dec 01 '22 13:12 merveenoyan

yeah that one is the same as the one used by tests to create the repos. So changing it doesn't gain us anything.

adrinjalali avatar Dec 02 '22 08:12 adrinjalali