Repository navigation
fix: know a GitHub App token's login, and drop the ready label when new commits arrive - #98
Merged
Merged
Conversation
…ew commits arrive - resolveOwnLogin asked `gh api user`, which an installation token can't read, then assumed github-actions[bot] under Actions. A GitHub App token was taken for github-actions[bot], so it never recognised its own review comment or removed its own ready label. It now asks GraphQL `viewer` next, accepts only a Bot, and adds the `[bot]` suffix REST uses; the github-actions[bot] fallback stays for when both fail. - The ready label kept saying "ready" after a push until the next review posted, or for good if that run was cancelled or killed. `ecr ci` now removes the bot's label before reviewing a `synchronize` event; the review adds it back if the new head is ready.
🤖 AI code reviewDecision: Ready for human review Overall PR risk: Medium. The change modifies how installation tokens resolve their login through GraphQL before falling back to github-actions[bot], and removes ready labels on new commits. Existing behavior is modified for token ownership and label lifecycle. Most plausible issues are incorrect viewer login detection causing duplicate comments, or extra workflow runs from label removal. The impact is bounded to App-token users with direct rollback available. 🔎 Reviewer summaries (3)
No findings. This review is advisory — it never blocks a merge and never auto-approves. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Two gaps left after #96 and #97:
resolveOwnLoginasksgh api user, which an installation token can't read (403), and then, under Actions, assumesgithub-actions[bot]. With a GitHub App token that guess is wrong, so the reviewer never recognises its own review comment (it posts a new one each run) and never removes the ready label it added.timeout-minutes.Change
resolveOwnLoginasks GraphQLviewer { login __typename }when/userfails. GitHub documents that query for installation tokens. Only aBotis accepted, since only an installation token gets that far, andviewerRestLoginadds the[bot]suffix REST uses for comment authors and event actors when GraphQL leaves it off. When both fail, thegithub-actions[bot]fallback under Actions is unchanged.ecr ciremoves the bot's ready label before it reviews apull_request/pull_request_targetsynchronizeevent (isNewCommitsEvent,GitHubReporter.removeReadyLabel), in both the single-config and routed paths. The review adds the label back if the new head is ready. A person's label is left alone, as before.unlabeledevent that starts another run; under the scaffolded workflow'scancel-in-progressit cancels this run and reviews the same head. That run isn't asynchronize, so it doesn't remove the label again. The defaultGITHUB_TOKENstarts no runs. The README says so.Test Plan
bun test(923 pass), typecheck, lint,fmt:checkandllp:checkpass. New tests:viewerRestLogin: a Bot gets the[bot]suffix once; a User or a missing type is rejectedgh: with/userfailing under Actions, an App'sviewerlogin is used and its label is removed; without aviewer, thegithub-actions[bot]fallback still removes its labelisNewCommitsEvent: true only for asynchronizepull_request/pull_request_targetevent, false for other actions, other events, and a missing or unreadable payloadremoveReadyLabelremoves the bot's label and leaves a person'sNot verified live: what GraphQL
viewerreturns for the defaultGITHUB_TOKEN. If it isn't a Bot, the existing fallback applies, so the default setup can't regress. This repo's CI runs the engine from the base commit, so this PR's own run doesn't exercise it.