Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions .roo/roomotes.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
version: "1.0"

commands:
- name: Pull latest changes
run: git pull
- name: Fetch and checkout PR branch
run: |
# Try to get PR info from various possible environment variables
if [ -n "$GITHUB_HEAD_REF" ]; then
echo "Checking out PR branch: $GITHUB_HEAD_REF"
git fetch origin "$GITHUB_HEAD_REF"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could we add error handling here? If the git fetch or checkout commands fail (network issues, permission problems, etc.), the script will continue and potentially run the translation check on the wrong branch. Consider:

Suggested change
git fetch origin "$GITHUB_HEAD_REF"
git fetch origin "$GITHUB_HEAD_REF" || { echo "Failed to fetch branch $GITHUB_HEAD_REF"; exit 1; }
git checkout -B "$GITHUB_HEAD_REF" "origin/$GITHUB_HEAD_REF" || { echo "Failed to checkout branch $GITHUB_HEAD_REF"; exit 1; }

git checkout -B "$GITHUB_HEAD_REF" "origin/$GITHUB_HEAD_REF"
elif [ -n "$GITHUB_REF" ] && [[ "$GITHUB_REF" =~ ^refs/pull/([0-9]+)/ ]]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this intentional to use bash-specific syntax without explicitly requiring bash? The [[ operator and BASH_REMATCH array are bash-specific features that won't work in sh or other shells. Consider either:

  1. Adding a shebang line at the start of the script section
  2. Using POSIX-compliant alternatives
  3. Ensuring the execution environment always uses bash

This could cause the script to fail silently in non-bash environments.

PR_NUMBER="${BASH_REMATCH[1]}"
echo "Fetching PR #$PR_NUMBER"
git fetch origin "pull/$PR_NUMBER/head:pr-$PR_NUMBER"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same error handling concern here - these git commands could fail silently. Adding error checks would make failures more visible.

git checkout "pr-$PR_NUMBER"
elif [ -n "$GITHUB_EVENT_PATH" ] && [ -f "$GITHUB_EVENT_PATH" ]; then
# Try to extract PR number from GitHub event JSON
PR_NUMBER=$(jq -r '.pull_request.number // .number // empty' "$GITHUB_EVENT_PATH" 2>/dev/null)
if [ -n "$PR_NUMBER" ]; then
echo "Fetching PR #$PR_NUMBER from event data"
git fetch origin "pull/$PR_NUMBER/head:pr-$PR_NUMBER"
git checkout "pr-$PR_NUMBER"
else
echo "Could not determine PR number from event data"
fi
else
echo "No PR information found in environment, using current branch"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could we make this fallback message more informative? It would be helpful to know which branch is actually being used:

Suggested change
echo "No PR information found in environment, using current branch"
echo "No PR information found in environment, using current branch: $(git branch --show-current)"

fi
timeout: 60
execution_phase: task_run
- name: Install dependencies
Expand Down