Skip to content

fix(scripts): support Windows paths and CRLF in protection and boundary scripts - #671

Open
Mohit-Gaur75 wants to merge 1 commit into
FindAny:mainfrom
Mohit-Gaur75:fix/scripts-windows-path-and-crlf
Open

Mohit-Gaur75 wants to merge 1 commit into
FindAny:mainfrom
Mohit-Gaur75:fix/scripts-windows-path-and-crlf

Conversation

@Mohit-Gaur75

Copy link
Copy Markdown

Summary

Fixes cross-platform execution issues on Windows for repository gating scripts:

  1. scripts/check-scoring-boundary.mjs: new URL("..", import.meta.url).pathname produced a path with a leading slash before the drive letter (e.g. /C:/...) and percent-encoded spaces (%20). When passed to path.join, this caused ENOENT: no such file or directory, scandir 'C:\C:\...'.
  2. scripts/feed-github-protection.mjs: validatePRChecks relied on LF (\n) for regex boundary assertions (such as indexOf('\njobs:\n') returning -1 and ^ name: ${literal}$ with $ in multiline mode failing when lines end in \r\n). When checked out on Windows with default CRLF line endings, all 19 test cases in feed-github-protection.test.mjs failed with Required PR job scoring/Scoring parity (TS / Go / Python) and boundary absent.

Changes

  • In scripts/check-scoring-boundary.mjs:
    • Use fileURLToPath(new URL("..", import.meta.url)) from node:url to properly resolve the workspace root across platforms.
  • In scripts/feed-github-protection.mjs:
    • Normalize CRLF to LF (workflow.replace(/\r\n/g, '\n')) at the start of validatePRChecks.
  • In scripts/feed-github-protection.test.mjs:
    • Normalize line endings when reading .github/workflows/scoring.yml so that string replacement assertions in tests match reliably across OS line ending conventions.

Verification

  • node --test scripts/feed-github-protection.test.mjs: 19 passed, 0 failed.
  • pnpm --filter @ghfind/scoring typecheck && pnpm --filter @ghfind/scoring test: 379 passed.
  • python3 -m pytest -q in packages/ghfind-py: 296 passed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant