Skip to content

Conversation

thebrianchen
Copy link
Contributor

@thebrianchen thebrianchen commented Sep 29, 2025

Pull Request Checklist


PR-Codex overview

This PR updates the scripts/vercel-ignore-build.sh script to improve error handling when fetching pull request information from the GitHub API, replacing jq with grep and sed for compatibility with Vercel's environment.

Detailed summary

  • Replaced jq with grep and sed to parse JSON response.
  • Added error handling for empty responses and API errors.
  • Extracted base.ref from the JSON response using grep and sed.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

vercel bot commented Sep 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
aa-sdk-ui-demo Ready Ready Preview Comment Sep 29, 2025 11:23pm

Copy link

github-actions bot commented Sep 29, 2025

🌿 Documentation Preview

Name Status Preview Updated (UTC)
Alchemy Docs ✅ Ready 🔗 Visit Preview Sep 29, 2025, 11:18 PM

Copy link
Contributor

@Copilot 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 removes the dependency on jq from the Vercel build script by replacing JSON parsing with native shell utilities. The change addresses the issue that jq is not available in the Vercel build environment.

  • Replaces jq JSON parsing with grep and sed commands
  • Adds error handling for GitHub API responses
  • Maintains the same functionality for extracting the PR base branch

if [ -z "$PR_RESPONSE" ]; then
echo "⚠️ No response from GitHub API"
elif echo "$PR_RESPONSE" | grep -q '"message"'; then
ERROR_MSG=$(echo "$PR_RESPONSE" | grep -o '"message":"[^"]*"' | sed 's/"message":"\([^"]*\)"/\1/')
Copy link
Preview

Copilot AI Sep 29, 2025

Choose a reason for hiding this comment

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

The regex pattern for extracting error messages is fragile and may break if the JSON contains escaped quotes or other special characters within the message string. Consider using a more robust approach or adding validation to handle edge cases.

Suggested change
ERROR_MSG=$(echo "$PR_RESPONSE" | grep -o '"message":"[^"]*"' | sed 's/"message":"\([^"]*\)"/\1/')
ERROR_MSG=$(echo "$PR_RESPONSE" | python3 -c 'import sys, json; print(json.load(sys.stdin).get("message", ""))')

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

stick with grep/sed, since python env is much less certain and can change with version

Copy link
Contributor

@jakehobbs jakehobbs left a comment

Choose a reason for hiding this comment

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

approved assuming you saw copilot's comment & aren't concerned

@thebrianchen thebrianchen merged commit 779a681 into main Sep 30, 2025
13 checks passed
@thebrianchen thebrianchen deleted the bc/fix-vercel-script branch September 30, 2025 00:14
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