Skip to content

bug: post-code.sh swallows gh pr create error output via 2>&1 redirect #34

Description

@guyoron1

Summary

When gh pr create fails in post-code.sh, the error message is not visible in the workflow logs because stderr is redirected into the PR_URL variable via 2>&1.

Details

The current implementation captures both stdout and stderr into the PR_URL variable:

PR_URL="$(gh pr create \
  --repo "${REPO_FULL_NAME}" \
  --head "${BRANCH}" \
  --base "${TARGET_BRANCH}" \
  --title "${PR_TITLE}" \
  --body "${PR_BODY}" \
  2>&1)"
echo "PR created: ${PR_URL}"

When gh pr create fails, the error message (e.g. 403 Forbidden, 422 Validation Failed) is stored in PR_URL instead of being printed to the logs.

Suggested Fix

Use the if ! pattern already used in reconcile-repos.sh:

if ! PR_URL=$(gh pr create \
  --repo "${REPO_FULL_NAME}" \
  --head "${BRANCH}" \
  --base "${TARGET_BRANCH}" \
  --title "${PR_TITLE}" \
  --body "${PR_BODY}"); then
  echo "::error::Failed to create PR: see above for details"
  exit 1
fi

Mirrored from fullsend-ai#2348

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-to-codeTriaged and ready for the code agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions