You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/actions/security/org-membership-check/README.md
+14-1Lines changed: 14 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,20 @@ This composite action checks if a GitHub user is a member of the dotCMS organiza
37
37
38
38
## Implementation Details
39
39
40
-
The action uses the GitHub CLI (`gh`) with the repository's `GITHUB_TOKEN` to check organization membership. It first attempts to check public membership, and if that fails, it attempts to check private membership (which requires appropriate permissions in organization repositories).
40
+
The action uses the GitHub CLI (`gh`) with the repository's `GITHUB_TOKEN` to check organization membership via the GitHub API endpoint `GET /orgs/dotCMS/members/{username}`.
41
+
42
+
**Key Design Decision: Status Code vs Response Body**
43
+
44
+
The action relies on HTTP status codes rather than parsing response content because:
45
+
46
+
- **HTTP 200 (Success)**: User is a member of the organization
47
+
- Public members: API returns user object with populated fields
48
+
- Private members: API returns empty response body (but still 200 OK)
49
+
50
+
- **HTTP 404 (Not Found)**: User is not a member of the organization
51
+
- Returns error object with "Not Found" message
52
+
53
+
This approach correctly authorizes all organization members (including owners with private membership) without needing to handle different response formats or visibility settings.
0 commit comments