From e6358cb37f61bc6887f7e90f79ec4ab194e62b39 Mon Sep 17 00:00:00 2001 From: "Po-Wei Wang (Vincent)" Date: Mon, 2 Jun 2025 21:17:01 -0700 Subject: [PATCH 1/4] add write permission Signed-off-by: Po-Wei Wang (Vincent) --- .github/workflows/label_community_pr.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/label_community_pr.yml b/.github/workflows/label_community_pr.yml index 6ae9322c4bf4..5230637636e0 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: From c4aac018ffc64778947ba8bee1d8a40abe94303f Mon Sep 17 00:00:00 2001 From: "Po-Wei Wang (Vincent)" Date: Mon, 2 Jun 2025 21:25:08 -0700 Subject: [PATCH 2/4] add members permission Signed-off-by: Po-Wei Wang (Vincent) --- .github/workflows/label_community_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/label_community_pr.yml b/.github/workflows/label_community_pr.yml index 5230637636e0..eb461bb6c55a 100644 --- a/.github/workflows/label_community_pr.yml +++ b/.github/workflows/label_community_pr.yml @@ -5,6 +5,7 @@ on: types: [opened] permissions: pull-requests: write + members: read jobs: label_pr: From f33c570c600ac5640ec412742790b131b240ac99 Mon Sep 17 00:00:00 2001 From: "Po-Wei Wang (Vincent)" Date: Mon, 2 Jun 2025 21:31:25 -0700 Subject: [PATCH 3/4] use my github token Signed-off-by: Po-Wei Wang (Vincent) --- .github/scripts/label_community_user.py | 2 +- .github/workflows/label_community_pr.yml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/scripts/label_community_user.py b/.github/scripts/label_community_user.py index d95f1bf372d7..9b04367ee487 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 = { diff --git a/.github/workflows/label_community_pr.yml b/.github/workflows/label_community_pr.yml index eb461bb6c55a..b6eaa37a79cb 100644 --- a/.github/workflows/label_community_pr.yml +++ b/.github/workflows/label_community_pr.yml @@ -5,7 +5,6 @@ on: types: [opened] permissions: pull-requests: write - members: read jobs: label_pr: @@ -24,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 }} From 48e75e103fd9ed39080746fe819ca2cb0ebda0a9 Mon Sep 17 00:00:00 2001 From: "Po-Wei Wang (Vincent)" Date: Mon, 2 Jun 2025 21:43:36 -0700 Subject: [PATCH 4/4] oppposite Signed-off-by: Po-Wei Wang (Vincent) --- .github/scripts/label_community_user.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/label_community_user.py b/.github/scripts/label_community_user.py index 9b04367ee487..4a31e96711d6 100644 --- a/.github/scripts/label_community_user.py +++ b/.github/scripts/label_community_user.py @@ -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: