-
Notifications
You must be signed in to change notification settings - Fork 180
add timestamp to mobile auto pull request branch name #1261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add timestamp to mobile auto pull request branch name #1261
Conversation
WalkthroughUpdates the mobile deploy GitHub Actions workflow to detect existing open bump PRs before creating a new one, switch to timestamped branch names, and exit early if a matching PR exists. Version bump logic remains, but PR creation is now guarded by the new check. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as GitHub Actions Runner
participant GH as GitHub API
participant Repo as Repo
participant PR as Pull Requests
Dev->>GH: Query open PRs targeting bump branch (matching criteria)
alt Existing PR found
GH-->>Dev: Return PR number and URL
Note right of Dev: Log existing PR info and exit
else No existing PR
Dev->>Repo: Create branch with timestamped name
Dev->>Repo: Apply version bump commits
Dev->>Repo: Push branch
Dev->>GH: Create new PR to target branch
GH-->>Dev: PR created (number, URL)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/mobile-deploy.yml (1)
1331-1339: Existing-PR detection is brittle (title-only match, default limit 30, race-prone)Title substring matching can false-positive; pagination can miss matches; race still possible. Filter by label/author and raise the limit. Example improvement:
-EXISTING_PR=$(gh pr list --base "${TARGET_BRANCH}" --state open --json number,title,headRefName --jq ".[] | select(.title | contains(\"${VERSION}\")) | .number" | head -1) +EXISTING_PR=$( + gh pr list \ + --base "${TARGET_BRANCH}" \ + --state open \ + --limit 200 \ + --search "in:title ${VERSION} label:automated author:app/github-actions" \ + --json number \ + --jq '.[0].number' \ + | head -1 +)Optional: repeat the same check immediately before gh pr create to reduce race windows.
If the "automated" label might not exist, either create it beforehand or drop the label filter and match headRefName prefix:
- --search "in:title ${VERSION} label:automated author:app/github-actions" \ + --search "in:title ${VERSION} author:app/github-actions" \
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/mobile-deploy.yml(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.github/workflows/**/*.{yml,yaml}
📄 CodeRabbit inference engine (AGENTS.md)
.github/workflows/**/*.{yml,yaml}: In GitHub workflows, use the shared composite actions in .github/actions for dependency caching instead of calling actions/cache directly
Use the cache-yarn composite action for Yarn dependency caching in workflows
Use the cache-bundler composite action for Ruby gems caching in workflows
Use the cache-gradle composite action for Gradle caching in workflows
Use the cache-pods composite action for CocoaPods caching in workflows
Files:
.github/workflows/mobile-deploy.yml
| # Add timestamp to branch name to avoid collisions | ||
| TIMESTAMP=$(date +%s%N | cut -b1-13) # Milliseconds since epoch (13 digits) | ||
| BRANCH_NAME="ci/bump-mobile-version-${VERSION}-${TIMESTAMP}" | ||
| PR_TITLE="${{ steps.platforms.outputs.pr_title }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timestamped branch avoids collisions, but duplicate PRs can slip in during races
Two concurrent runs can both pass the pre-check and open two PRs for the same version (different timestamps). Add a second existence check right before gh pr create (after push), or strengthen global concurrency to serialize by bump_target_branch to prevent duplicates.
Suggested follow-ups:
- Re-check for existing PR after the push, before creation.
- Consider tying the workflow concurrency group to bump_target_branch to serialize PR creation to the same target branch.
🤖 Prompt for AI Agents
.github/workflows/mobile-deploy.yml around lines 1323 to 1326: the workflow
creates a timestamped branch to avoid collisions but may still open duplicate
PRs from concurrent runs; add a second check for an existing PR after the git
push and before running gh pr create, and/or scope the workflow concurrency to
the bump_target_branch so runs targeting the same branch are serialized;
implement by querying GitHub (gh pr list or API) for an open PR that matches the
intended version/target branch immediately after push and abort creation if
found, or set the workflow concurrency group to include bump_target_branch to
prevent parallel PR creation.
Summary by CodeRabbit
Bug Fixes
Chores