Fix reply-to-feedback authorization api#105
Merged
derekmisler merged 1 commit intodocker:mainfrom Mar 20, 2026
Merged
Conversation
399e491 to
ef5516f
Compare
Signed-off-by: Derek Misler <derek.misler@docker.com>
ef5516f to
5af8e59
Compare
Contributor
Author
|
/describe |
Contributor
|
✅ PR description has been generated and updated! |
Contributor
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
The changes improve authorization logic by switching from author_association to org membership checking with proper fallback. The validation of ROOT_COMMENT_ID and the API field name fix (in_reply_to_id → in_reply_to) are good improvements.
Minor observations noted in inline comments for future consideration.
trungutt
approved these changes
Mar 20, 2026
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.
Summary
This PR fixes the authorization check in the reply-to-feedback workflow step. The previous implementation relied solely on
author_associationfrom the GitHub event context (which can be unreliable inworkflow_callcontexts), replacing it with a direct GitHub API call to verify org membership. It also fixes a bug where thejqpayload usedin_reply_to_idinstead of the correctin_reply_tofield.Changes
.github/workflows/review-pr.yml—authstep: Replaces theauthor_association-based authorization with an explicitgh api orgs/$ORG/members/$USERNAMEmembership check usingCAGENT_ORG_MEMBERSHIP_TOKEN. Falls back toauthor_associationif the token is not configured..github/workflows/review-pr.yml—authstep: Adds robust HTTP response parsing — validates the response starts with an HTTP status line, extracts the status code viagrep -oP, and handles unexpected formats gracefully..github/workflows/review-pr.yml—Notify unauthorized userstep: Adds validation thatROOT_COMMENT_IDis set and is a valid integer before passing it tojq/gh api, preventing silent failures..github/workflows/review-pr.yml—Notify unauthorized userstep: Fixes thejqpayload key fromin_reply_to_idtoin_reply_to, which is the correct field name for the GitHub Pull Request Review Comments API.Breaking Changes
CAGENT_ORG_MEMBERSHIP_TOKENsecret (scoped to org membership read) must be configured for the primary authorization path to work. Without it, the workflow falls back toauthor_association.auto-review-orginput must be set correctly, as it is now used as the org name in the membership API call.How to Test
authorized=trueis set and the reply workflow proceeds.authorized=falseis set and the unauthorized notification comment is posted correctly (and usesin_reply_toin the API payload).CAGENT_ORG_MEMBERSHIP_TOKENunset and verify the fallback toauthor_associationlogic works as expected with a warning logged.Closes: https://github.com/docker/gordon/issues/260