diff --git a/.github/workflows/trufflehog.yml b/.github/workflows/trufflehog.yml new file mode 100644 index 0000000000..9cbbf68037 --- /dev/null +++ b/.github/workflows/trufflehog.yml @@ -0,0 +1,15 @@ +on: + push: + +name: Secret Leaks + +jobs: + trufflehog: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Secret Scanning + uses: trufflesecurity/trufflehog@main diff --git a/src/huggingface_hub/repository.py b/src/huggingface_hub/repository.py index 8db06f21b8..09b4bbc777 100644 --- a/src/huggingface_hub/repository.py +++ b/src/huggingface_hub/repository.py @@ -542,10 +542,10 @@ def __init__( user = self.client.whoami(self.huggingface_token) if git_email is None: - git_email = user["email"] + git_email = user.get("email") if git_user is None: - git_user = user["fullname"] + git_user = user.get("fullname") if git_user is not None or git_email is not None: self.git_config_username_and_email(git_user, git_email)