diff --git a/.github/scripts/label_community_user.py b/.github/scripts/label_community_user.py index d95f1bf372d7..4a31e96711d6 100644 --- a/.github/scripts/label_community_user.py +++ b/.github/scripts/label_community_user.py @@ -4,7 +4,7 @@ import requests GITHUB_API_URL = "https://api.github.com" -GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN") +GITHUB_TOKEN = os.environ.get("MY_GITHUB_TOKEN") assert GITHUB_TOKEN, "GITHUB_TOKEN environment variable not set" HEADERS = { @@ -95,9 +95,9 @@ def main(): is_member = pr_author.lower() in nvidia_members print(f"User '{pr_author}' is a member of NVIDIA: {is_member}") - if not is_member: + if is_member: print( - f"User '{pr_author}' is a community user. Adding label '{community_label}'." + f"User '{pr_author}' is not a community user. Adding label '{community_label}'." ) add_label_to_pr(repo_name, pr_number, community_label) else: diff --git a/.github/workflows/label_community_pr.yml b/.github/workflows/label_community_pr.yml index 6ae9322c4bf4..b6eaa37a79cb 100644 --- a/.github/workflows/label_community_pr.yml +++ b/.github/workflows/label_community_pr.yml @@ -3,6 +3,8 @@ name: Label Community PR on: pull_request: types: [opened] +permissions: + pull-requests: write jobs: label_pr: @@ -21,7 +23,7 @@ jobs: - name: Run labeling script env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MY_GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} PR_AUTHOR: ${{ github.event.pull_request.user.login }} PR_NUMBER: ${{ github.event.pull_request.number }} REPO_NAME: ${{ github.event.repository.name }}