-
Notifications
You must be signed in to change notification settings - Fork 7
fix(actions): improve onboarding messaging & remove invalid token check #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(actions): improve onboarding messaging & remove invalid token check #20
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @Ubayed-Bin-Sufian, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR improves the onboarding workflow by enhancing user-facing messages and removing a redundant token validation check. The changes aim to provide clearer feedback based on whether a user is newly invited or already a member.
- Adds a debug step to verify the presence of
ORG_ADMIN_TOKENbefore execution - Refactors org membership logic to distinguish between new invitations and existing memberships
- Improves messaging to provide context-specific instructions based on membership status
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Wrap setMembershipForUser call in try-catch to provide user feedback and graceful failure when organization invitation fails.
Use membership.data.state to accurately determine if user needs to accept invitation, rather than relying solely on invited flag.
|
@sourcery-ai review |
Reviewer's GuideGitHub Actions onboarding workflow was updated to validate the presence of the org admin token at the shell level, refine how organization membership is checked and invitations are sent, and improve the clarity and robustness of the onboarding status messaging posted back to the issue. Sequence diagram for the updated onboarding GitHub Action workflowsequenceDiagram
actor User
participant GitHub
participant Workflow_org_invite
participant GitHub_API
User->>GitHub: Open onboarding issue
GitHub-->>Workflow_org_invite: Trigger org-invite-codeheat workflow
rect rgb(230,230,230)
Workflow_org_invite->>Workflow_org_invite: Debug secret presence step
Workflow_org_invite->>Workflow_org_invite: Read ORG_ADMIN_TOKEN from secrets
alt ORG_ADMIN_TOKEN missing
Workflow_org_invite-->>GitHub: Log ORG_ADMIN_TOKEN is NOT available
Workflow_org_invite-->>Workflow_org_invite: Exit with failure
else ORG_ADMIN_TOKEN present
Workflow_org_invite-->>GitHub: Log ORG_ADMIN_TOKEN is available
end
end
Workflow_org_invite->>GitHub_API: getMembershipForUser(org, username)
alt Membership found (200)
GitHub_API-->>Workflow_org_invite: membership(state = active or pending)
Workflow_org_invite->>GitHub_API: addOrUpdateTeamMembershipForUser(org, team_slug, username)
GitHub_API-->>Workflow_org_invite: teamMembership or error
Workflow_org_invite-->>GitHub: Post onboarding comment with orgStatusLine "Org membership: already active" or orgStatusLine with membership state
Workflow_org_invite-->>GitHub: Close issue (best effort)
else Membership not found (404)
GitHub_API-->>Workflow_org_invite: 404 not found error
Workflow_org_invite->>GitHub_API: setMembershipForUser(org, username)
alt Invitation succeeds
GitHub_API-->>Workflow_org_invite: membership(state = pending)
Workflow_org_invite->>GitHub_API: addOrUpdateTeamMembershipForUser(org, team_slug, username)
GitHub_API-->>Workflow_org_invite: teamMembership or error
Workflow_org_invite-->>GitHub: Post onboarding comment with orgStatusLine "Org invitation" and actionMessage
Workflow_org_invite-->>GitHub: Close issue (best effort)
else Invitation fails
GitHub_API-->>Workflow_org_invite: inviteError
Workflow_org_invite-->>GitHub: Comment Onboarding failed (invite error)
Workflow_org_invite-->>Workflow_org_invite: Mark job failed
end
else Unexpected error retrieving membership
GitHub_API-->>Workflow_org_invite: error(status != 404)
Workflow_org_invite-->>GitHub: Comment Onboarding failed (membership lookup)
Workflow_org_invite-->>Workflow_org_invite: Mark job failed
end
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've found 1 issue, and left some high level feedback:
- The separate
Debug secret presencestep will now fail the workflow before any user-facing comment is posted ifORG_ADMIN_TOKENis missing; if you still want contributors to get guidance in-issue, consider keeping a lightweight in-script validation or adding an explicit issue comment in this early step before exiting. - The
Debug secret presencestep permanently logs whetherORG_ADMIN_TOKENexists on every run; if this is only needed for troubleshooting, consider guarding it behind a condition (e.g., on a debug input or branch) or removing it once the issue is resolved.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The separate `Debug secret presence` step will now fail the workflow before any user-facing comment is posted if `ORG_ADMIN_TOKEN` is missing; if you still want contributors to get guidance in-issue, consider keeping a lightweight in-script validation or adding an explicit issue comment in this early step before exiting.
- The `Debug secret presence` step permanently logs whether `ORG_ADMIN_TOKEN` exists on every run; if this is only needed for troubleshooting, consider guarding it behind a condition (e.g., on a debug input or branch) or removing it once the issue is resolved.
## Individual Comments
### Comment 1
<location> `.github/workflows/org-invite-codeheat.yml:131-133` </location>
<code_context>
);
}
+ const orgStatusLine = invited
+ ? `• Org invitation: **${membership.data.state}**\n`
+ : `• Org membership: **already active**\n`;
+
const teamStatusLine = teamMembership
</code_context>
<issue_to_address>
**issue (bug_risk):** Org membership text can be incorrect for existing but pending members.
When `getMembershipForUser` returns `state === 'pending'` for an existing membership, `invited` stays `false`, so `orgStatusLine` becomes `"• Org membership: **already active**"`, even though the later `actionMessage` logic correctly treats this as pending. Please derive `orgStatusLine` from `membership.data.state` in both cases (or at least special-case `pending` when `invited === false`) so the status text matches the actual membership state.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| const orgStatusLine = invited | ||
| ? `• Org invitation: **${membership.data.state}**\n` | ||
| : `• Org membership: **already active**\n`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Org membership text can be incorrect for existing but pending members.
When getMembershipForUser returns state === 'pending' for an existing membership, invited stays false, so orgStatusLine becomes "• Org membership: **already active**", even though the later actionMessage logic correctly treats this as pending. Please derive orgStatusLine from membership.data.state in both cases (or at least special-case pending when invited === false) so the status text matches the actual membership state.
Fixes: #18
Summary by Sourcery
Improve the organization onboarding GitHub Action to better handle missing secrets, distinguish between existing members and new invites, and provide clearer feedback messages.
Bug Fixes:
Enhancements: