Post comments/reactions/labels/reviews as github-actions[bot]
Previously the action used the PAT (SLASH_COMMANDS_TOKEN) for everything,
so comments and reviews showed as authored by whoever owns the PAT. This
is confusing — the PAT exists only because team-membership checks need
read:org, which GITHUB_TOKEN can never have.
New bot-token input (default ${{ github.token }}) is used for all
user-visible side effects. The PAT is now scoped to what actually needs
it: team membership, CODEOWNERS fetch, listFiles, pulls.get, and
workflow dispatch.
Side benefit: the PAT's required scopes shrink. It no longer needs
Pull requests:write or Issues:write — just Contents:read + Members:read
(+ Actions:write for /stageblog). README updated to reflect this.
This commit is contained in:
parent
df23d396f5
commit
cad4102f07
1 changed files with 43 additions and 23 deletions
|
|
@ -9,11 +9,21 @@ description: >-
|
|||
inputs:
|
||||
github-token:
|
||||
description: >-
|
||||
Token for API calls. MUST have read:org scope to check team membership —
|
||||
the default GITHUB_TOKEN cannot do this. Use a fine-grained PAT with
|
||||
Organization Members:read + Repository Contents:read + Pull requests:write
|
||||
+ Issues:write, or a GitHub App installation token with equivalent perms.
|
||||
Token for org team-membership checks and workflow dispatch. MUST have
|
||||
read:org scope — the default GITHUB_TOKEN cannot do this. Use a
|
||||
fine-grained PAT with Organization Members:read (+ Actions:write if
|
||||
using /stageblog), or a GitHub App installation token with equivalent
|
||||
perms.
|
||||
required: true
|
||||
bot-token:
|
||||
description: >-
|
||||
Token used for user-visible side effects (comments, reactions, labels,
|
||||
reviews). Defaults to the automatic GITHUB_TOKEN so these show as
|
||||
authored by github-actions[bot]. The caller workflow must grant this
|
||||
token the necessary repo permissions (pull-requests: write,
|
||||
issues: write).
|
||||
required: false
|
||||
default: ${{ github.token }}
|
||||
approved-label:
|
||||
description: Label added by /lgtm and used by the status job as the merge gate
|
||||
required: false
|
||||
|
|
@ -85,6 +95,7 @@ runs:
|
|||
SUBMIT_REVIEW: ${{ inputs.submit-review }}
|
||||
STAGEBLOG_WORKFLOW: ${{ inputs.stageblog-workflow }}
|
||||
STAGEBLOG_PATHS: ${{ inputs.stageblog-paths }}
|
||||
BOT_TOKEN: ${{ inputs.bot-token }}
|
||||
with:
|
||||
github-token: ${{ inputs.github-token }}
|
||||
script: |
|
||||
|
|
|
|||
Loading…
Reference in a new issue