Skip to content

Commit f0eaa46

Browse files
chore(workflows): improve portability of PR number extraction by replacing grep with sed
1 parent 7ba4bdf commit f0eaa46

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

.github/workflows/code-review.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
echo "pr_url=${ISSUE_URL}" >> "${GITHUB_OUTPUT}"
8888
8989
# Extract PR number from URL
90-
PR_NUMBER=$(echo "${INPUTS_PR_URL}" | grep -oP '(?<=pull/)\d+')
90+
PR_NUMBER=$(echo "${INPUTS_PR_URL}" | sed -n 's|.*/pull/\([0-9]*\)$|\1|p')
9191
echo "pr_number=${PR_NUMBER}" >> "${GITHUB_OUTPUT}"
9292
9393
elif [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
@@ -158,7 +158,7 @@ jobs:
158158
🟡 IMPORTANT: Race conditions, hardcoded test names, missing unique identifiers
159159
🟡 IMPORTANT: Database changes without make gen, unhandled errors causing crashes
160160
🟡 IMPORTANT: Resource leaks, timing bugs (time.Sleep instead of quartz)
161-
🔵 NITPICK: Portability issues (grep -oP vs sed), minor improvements, readability
161+
🔵 NITPICK: Portability issues (grep -oP is GNU-only, use sed for macOS/BSD)
162162
163163
COMMENT WITH SUGGESTIONS:
164164
- For CRITICAL/IMPORTANT issues: Standard inline suggestions
@@ -221,8 +221,7 @@ jobs:
221221
\`\`\`
222222
223223
GOOD Comment on line 234 (NITPICK):
224-
Issue: [NITPICK] grep -oP uses Perl regex which is GNU-specific. Works on GitHub Actions
225-
but sed is more portable across all Unix systems.
224+
Issue: [NITPICK] grep -oP is GNU-specific. sed is more portable for macOS/BSD users.
226225
227226
\`\`\`suggestion
228227
PR_NUM=\$(echo "\${URL}" | sed -n 's|.*/pull/\\([0-9]*\\)$|\\1|p')

0 commit comments

Comments
 (0)