From 4980c14a8d1273c51d1a2622ef7f6a73b19a52f0 Mon Sep 17 00:00:00 2001 From: Lucain Date: Mon, 10 Jun 2024 09:29:03 +0200 Subject: [PATCH 1/3] Fix Repository if whoami call doesn't return an email (#2320) --- src/huggingface_hub/repository.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) From 0ca188aa387d2af37f1399a009127fb5b04f6629 Mon Sep 17 00:00:00 2001 From: Luc Georges Date: Mon, 10 Jun 2024 10:01:05 +0200 Subject: [PATCH 2/3] feat(ci): add trufflehog secrets detection (#2321) --- .github/workflows/trufflehog.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/trufflehog.yml diff --git a/.github/workflows/trufflehog.yml b/.github/workflows/trufflehog.yml new file mode 100644 index 0000000000..ba6fdda9b6 --- /dev/null +++ b/.github/workflows/trufflehog.yml @@ -0,0 +1,21 @@ +on: + push: + +name: Secret Leaks + +permissions: + contents: read + id-token: write + issues: write + pull-requests: write + +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 From 6e15d6b2f7b97fb114cf8c18a9bd3289c6dc3b4d Mon Sep 17 00:00:00 2001 From: Luc Georges Date: Mon, 10 Jun 2024 11:43:12 +0200 Subject: [PATCH 3/3] fix(ci): remove unnecessary permissions (#2322) --- .github/workflows/trufflehog.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/trufflehog.yml b/.github/workflows/trufflehog.yml index ba6fdda9b6..9cbbf68037 100644 --- a/.github/workflows/trufflehog.yml +++ b/.github/workflows/trufflehog.yml @@ -3,12 +3,6 @@ on: name: Secret Leaks -permissions: - contents: read - id-token: write - issues: write - pull-requests: write - jobs: trufflehog: runs-on: ubuntu-latest