Skip to content

[jsweep] Clean check_membership.cjs#22831

Draft
github-actions[bot] wants to merge 1 commit intomainfrom
jsweep/check-membership-cleanup-c2314ad73900f5a9
Draft

[jsweep] Clean check_membership.cjs#22831
github-actions[bot] wants to merge 1 commit intomainfrom
jsweep/check-membership-cleanup-c2314ad73900f5a9

Conversation

@github-actions
Copy link
Contributor

Summary

Cleaned check_membership.cjs — a github-script context file that handles repository membership and permission validation.

Changes

check_membership.cjs — removed redundant null guards:

  • parseRequiredPermissions() always returns string[] (via ?? []), so !requiredPermissions || was a dead check
  • parseAllowedBots() always returns string[] (via ?? []), so allowedBots && was a dead check
-  if (!requiredPermissions || requiredPermissions.length === 0) {
+  if (requiredPermissions.length === 0) {
-    if (allowedBots && allowedBots.length > 0) {
+    if (allowedBots.length > 0) {

Test improvements

check_membership.test.cjs — 24 → 26 tests (+2):

New test Purpose
should skip bot check when GH_AW_ALLOWED_BOTS is empty string Verifies empty string env var yields only 1 API call and no bot check
should skip bot check when GH_AW_ALLOWED_BOTS is not set Verifies unset env var yields only 1 API call and no bot check

Context

  • Execution context: github-script
  • No logic changed — pure code clarity improvements

✅ Validation checks

  • Formatting: npm run format:cjs
  • Linting: npm run lint:cjs
  • Type checking: npm run typecheck
  • Tests: npm run test:js -- --no-file-parallelism ✓ (26/26 passed)

Generated by jsweep - JavaScript Unbloater ·

  • expires on Mar 27, 2026, 4:41 AM UTC

- Remove redundant null guard on parseRequiredPermissions() return value
  (always returns string[], never null/undefined)
- Remove redundant null guard on parseAllowedBots() return value
  (always returns string[], never null/undefined)
- Add 2 new tests: empty and unset GH_AW_ALLOWED_BOTS skip bot check
  (24 → 26 tests)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants