Skip to content

ci: harden CLA username matching and batch-PR handling#342

Open
prasanna-anchorage wants to merge 1 commit into
mainfrom
fix/cla-username-matching
Open

ci: harden CLA username matching and batch-PR handling#342
prasanna-anchorage wants to merge 1 commit into
mainfrom
fix/cla-username-matching

Conversation

@prasanna-anchorage
Copy link
Copy Markdown
Contributor

What

Latent robustness fixes in the CLA workflows, found while porting this flow to anchorageoss/sqisign-rs (Copilot flagged them there; the same code lives here).

  • Username matching (cla-file-check.yml, add-cla-user.yml ×2): replace grep -q -w "$user" with grep -Fxq "$user" (fixed-string, whole-line). GitHub logins like github-actions[bot] / dependabot[bot] contain [ which grep -w treats as a regex character class — it can error or false-negative. Also tolerate a missing .cla-signed-users (treat as unsigned) instead of erroring.
  • Batch-branch race (add-cla-user.yml): add a concurrency group on cla-signers-batch (no cancel-in-progress) so two near-simultaneous /approve-cla runs don't race on the push and drop a signer.
  • Batch PR number parsing (add-cla-user.yml): gh pr create prints the PR URL (…/pull/123), so grep -o '#[0-9]\+' matched nothing and left NEW_PR blank (broken follow-up comment). Parse the trailing number from the URL instead.

No behavior change for already-listed human signers; this only fixes bot logins, the concurrency race, and the empty PR-number bug.

Test

actionlint/YAML parse clean. The matching change is verifiable: printf 'github-actions[bot]\n' | grep -Fxq 'github-actions[bot]' succeeds, whereas grep -w errors/misbehaves on the [.

🤖 Generated with Claude Code

Found while porting this CLA flow to anchorageoss/sqisign-rs; these are
latent here too:

- Match signers with `grep -Fxq` (fixed-string, whole-line) instead of
  `grep -q -w`, so logins containing regex metacharacters -- e.g.
  `github-actions[bot]`, `dependabot[bot]` -- aren't mis-parsed (the `[`
  starts a character class and can error or false-negative). Also treat a
  missing `.cla-signed-users` as "not signed" rather than erroring.
- Add a `concurrency` group on the shared `cla-signers-batch` branch so
  simultaneous `/approve-cla` runs don't race on the push.
- Parse the new batch PR number from the `gh pr create` URL (trailing
  number) instead of a `#NNN` pattern that never matches a URL (leaving
  the follow-up comment blank).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 28, 2026 23:25
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 hardens CLA automation workflows by making username checks safer for bot-style GitHub logins and improving batch CLA signer PR handling.

Changes:

  • Replaces regex/word-boundary username matching with fixed-string whole-line matching.
  • Adds serialization for shared cla-signers-batch workflow updates.
  • Fixes batch PR number extraction from gh pr create URL output.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/workflows/cla-file-check.yml Safely checks CLA signer usernames and treats a missing signer file as unsigned.
.github/workflows/add-cla-user.yml Serializes batch signer updates, uses fixed-string username checks, and parses created PR numbers from URLs.

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

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.

2 participants