Skip to content

trim only ascii whitespace for branch - #2521

Merged
aiqiaoy merged 2 commits into
mainfrom
aiqiaoy/unicode-branch
Jul 15, 2026
Merged

trim only ascii whitespace for branch#2521
aiqiaoy merged 2 commits into
mainfrom
aiqiaoy/unicode-branch

Conversation

@aiqiaoy

@aiqiaoy aiqiaoy commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Copilot Bot review requested due to automatic review settings July 15, 2026 18:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 addresses a potential safety issue where @actions/core’s default whitespace trimming can strip certain Unicode characters (e.g., BOM/NBSP) from the ref input, causing an unintended reclassification of a ref-like value as a commit SHA and impacting the unsafe fork PR checkout guard.

Changes:

  • Add ASCII-only trimming logic for ref to avoid Unicode character stripping when determining whether the value is a raw SHA.
  • Extend unit tests to cover BOM-prefixed SHA-like refs and ASCII-whitespace-surrounded SHAs.
  • Regenerate dist/index.js to include the updated behavior.
Show a summary per file
File Description
src/input-helper.ts Introduces ASCII-only trimming for SHA detection on ref to avoid Unicode-trim surprises.
__test__/input-helper.test.ts Updates getInput mocking and adds regression tests for BOM + SHA-like inputs.
dist/index.js Bundled output reflecting the source change.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/3 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment thread src/input-helper.ts
Comment thread __test__/input-helper.test.ts
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.

3 participants