Skip to content

fix(ci): replace grep -P with portable sed for cross-platform compatibility#244

Merged
iap merged 1 commit into
devfrom
fix/grep-portability-validate-workflows
May 28, 2026
Merged

fix(ci): replace grep -P with portable sed for cross-platform compatibility#244
iap merged 1 commit into
devfrom
fix/grep-portability-validate-workflows

Conversation

@iap

@iap iap commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes CodeRabbit finding from PR #242 about macOS/BSD portability.

Problem

grep -P (Perl regex) is not available on macOS/BSD systems by default, causing the workflow validation script to fail on those platforms.

Solution

  • Replaces grep -P with sed -E (POSIX extended regex)
  • Handles both quoted and unquoted node versions
  • Supports semantic versions (e.g., 24.16.0)
  • Skips matrix variables (returns empty, as intended)

Changes

- WORKFLOW_NODE=$(grep "node-version:" "$workflow" | head -1 | grep -oP "'\\K[0-9]+" || true)
+ WORKFLOW_NODE=$(grep "node-version:" "$workflow" | head -1 | sed -nE "s/.*node-version:[[:space:]]*['\"]?([0-9.]+).*/\1/p")

Testing

bash .github/scripts/validate-workflows.sh
# ✅ All workflows validated

# Test semantic version extraction
echo "node-version: '24.16.0'" | sed -nE "s/.*node-version:[[:space:]]*['\"]?([0-9.]+).*/\1/p"
# Output: 24.16.0

Related

…bility

- Replaces grep -P (Perl regex, not available on macOS/BSD) with sed -E
- Uses POSIX extended regex for better portability
- Handles both quoted and unquoted node versions
- Skips matrix variables (returns empty, as intended)

Fixes CodeRabbit finding from PR #242 about macOS portability.

Co-authored-by: CodeRabbit <support@coderabbit.ai>
@iap iap requested a review from a team as a code owner May 28, 2026 02:02
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b08b776fe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/scripts/validate-workflows.sh
Comment thread .github/scripts/validate-workflows.sh
@iap iap merged commit 44faf80 into dev May 28, 2026
16 checks passed
@iap iap deleted the fix/grep-portability-validate-workflows branch May 28, 2026 05:10
iap added a commit that referenced this pull request Jun 2, 2026
…bility (#244)

- Replaces grep -P (Perl regex, not available on macOS/BSD) with sed -E
- Uses POSIX extended regex for better portability
- Handles both quoted and unquoted node versions
- Skips matrix variables (returns empty, as intended)

Fixes CodeRabbit finding from PR #242 about macOS portability.

Co-authored-by: CodeRabbit <support@coderabbit.ai>
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