Skip to content

Commit

Permalink
Work around for permissions issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hvidy committed Feb 14, 2024
1 parent ce31d0e commit 7fce049
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .github/scripts/approval_authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)

Expand All @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/approve-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down

0 comments on commit 7fce049

Please sign in to comment.