diff --git a/.github/scripts/approval_authorization.py b/.github/scripts/approval_authorization.py index 8ee2747..2f0af7d 100644 --- a/.github/scripts/approval_authorization.py +++ b/.github/scripts/approval_authorization.py @@ -3,6 +3,7 @@ if __name__ == "__main__": token = os.environ.get("GITHUB_TOKEN") + org_token = os.enviorn.get("ORG_TOKEN") org_name = os.environ.get("OWNER") repo_name = os.environ.get("REPO") @@ -11,7 +12,7 @@ user_login = os.environ.get("USER") # Get user and team - auth = Auth.Token(token) + auth = Auth.Token(org_token) g = Github(auth=auth) org = g.get_organization(org_name) @@ -22,6 +23,11 @@ authorized = team.has_in_members(user) if not authorized: + # FIXME: Need to change token here because not currently setup to remove issue label on that PAT + auth = Auth.Token(token) + g = Github(auth=auth) + org = g.get_organization(org_name) + # Remove approved label because it isn't issue = org.get_repo(repo_name).get_issue(number = issue_number) issue.remove_from_labels("approved") diff --git a/.github/workflows/approve-label.yml b/.github/workflows/approve-label.yml index 7d56c2f..2548e26 100644 --- a/.github/workflows/approve-label.yml +++ b/.github/workflows/approve-label.yml @@ -89,7 +89,8 @@ jobs: - name: Verify Labeler id: verify_labeler env: - GITHUB_TOKEN: ${{ secrets.TIM_PAT }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ORG_TOKEN: ${{ secrets.TIM_PAT }} USER: ${{ github.event.sender.login }} OWNER: ${{ github.event.repository.owner.login }} REPO: ${{ github.event.repository.name }}