Skip to content

fix(community-autotag): apply the community label as github-actions[bot], not the PAT owner - #157

Open
jashansinghTT wants to merge 1 commit into
tenstorrent:mainfrom
jashansinghTT:fix/community-label-as-github-actions
Open

jashansinghTT wants to merge 1 commit into
tenstorrent:mainfrom
jashansinghTT:fix/community-label-as-github-actions

Conversation

@jashansinghTT

Copy link
Copy Markdown

What

In issues-community-autotag.yml, the two steps that create and apply the community label now authenticate with the built-in github.token instead of the AUTOLABEL_COMMUNITY_ISSUES PAT. The membership check keeps using the PAT, because the built-in token cannot read org membership.

Why

Every community label event is currently attributed to whoever owns the PAT. In tt-flash and tt-kmd that is tenstorrent-github-bot; in repos that stored an employee's PAT it is that employee. The label should visibly come from automation, i.e. github-actions[bot].

Effect on callers

None required. The template caller (repo-community-labeling.yml in tenstorrent/.github) already grants issues: write and pull-requests: write, and this workflow's job declares the same, which is all gh issue edit --add-label / gh pr edit --add-label and label creation need. The PAT can now be narrowed to read:org only.

Not changed here

pull_request from forks still gets no secrets, so the membership step fails on fork PRs. That needs pull_request_target support and is a separate change.

🤖 Generated with Claude Code

The "Ensure community label exists" and "Apply community label" steps
authenticated with AUTOLABEL_COMMUNITY_ISSUES, so every `community` label
event was attributed to the PAT's owner (tenstorrent-github-bot in
tt-flash / tt-kmd today, or whichever employee's PAT a repo happens to
hold). Switch those two steps to the built-in github.token so the label
is created and applied by github-actions[bot].

The PAT is still used for the one thing the built-in token cannot do:
read org membership (including private members). Callers already grant
issues: write and pull-requests: write, which is all the label steps need.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The collaborator lookup still requires repository access beyond the documented read:org scope.

Pull request overview

Updates community labeling to use the built-in GitHub token so actions are attributed to github-actions[bot].

Changes:

  • Uses github.token for label creation and application.
  • Retains the PAT for organization membership checks.
  • Clarifies token usage and required permissions.
File summaries
File Description
.github/workflows/issues-community-autotag.yml Separates membership authentication from label mutation authentication.
Review details

Suppressed comments (1)

.github/workflows/issues-community-autotag.yml:7

  • This description now says the secret is used only for org membership and can be narrowed to read:org, but the step also calls GET /repos/.../collaborators/${USERNAME} at lines 99-103. That endpoint requires repository metadata access (and repo in addition to read:org for a classic PAT), so the advertised scope makes the collaborator check return 403/404 and misreports collaborators as external_user; either remove this redundant lookup or document/retain its required repository permission.
        description: 'Token used only to check organization membership (needs read:org). Labels are applied with the built-in github.token so they are attributed to github-actions[bot].'
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants