fix(ci): trigger deploy-preview on Release PR updates#287
Conversation
…dates Signed-off-by: itvi-1234 <rjsumit71@gmail.com>
Signed-off-by: itvi-1234 <rjsumit71@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughWorkflow updates to preview build: quoted branch glob, concurrency key changed to use head repo fallback, a new step derives PR number for both pull_request and other events (via Changes
Sequence Diagram(s)sequenceDiagram
participant Event as GitHub Event
participant Runner as Actions Runner
participant GH as gh / GitHub API
participant FS as Filesystem
Event->>Runner: workflow triggered (push or pull_request)
Runner->>Runner: determine concurrency key (uses PR head repo fallback)
Runner->>Runner: run "Determine PR number" step
alt event is pull_request
Runner->>Runner: read github.event.pull_request.number -> output number
else non-PR event
Runner->>GH: gh pr list --head "${{ github.ref_name }}"
GH-->>Runner: PR number(s) or empty
alt PR found
Runner->>Runner: output found PR number
else none found
Runner-->>Event: fail job with error
end
end
Runner->>FS: write step output to `pr_number.txt`
Runner->>Runner: continue preview build steps
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Preview Deployed!
Last updated at 2026-04-05T13:16:39Z |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/build-preview.yml:
- Around line 10-12: The concurrency group key must be the same for push and
pull_request runs; replace the current expression so it uses the branch name
from the PR when present and falls back to the push ref otherwise — update the
concurrency.group expression (the group under the concurrency block) to use
github.event.pull_request.head.ref || github.ref (or equivalent head ref
property) so both push and pull_request for the same branch produce the same key
and cancel-in-progress works.
- Around line 35-45: The "Determine PR number" step (id: pr) may write a literal
"null" when `gh pr list --head "${{ github.ref_name }}" --json number --jq
'.[0].number'` finds no PR; change the shell logic to detect that case, validate
PR_NUMBER is non-empty and not "null" before echoing to $GITHUB_OUTPUT, and if
invalid exit non‑zero with a clear error message so the workflow fails fast
instead of emitting an invalid number; preserve the existing branch that uses
`github.event.pull_request.number` but ensure any PR_NUMBER derived from `gh pr
list` is checked and only written when valid.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9fdfeb96-45a4-4469-b53a-185fe4e7c4be
📒 Files selected for processing (1)
.github/workflows/build-preview.yml
| concurrency: | ||
| group: preview-build-${{ github.event.pull_request.number }} | ||
| group: preview-build-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
If a GitHub Actions workflow listens to both pushandpull_request, does pushing to a branch with an open pull request trigger both workflow runs? Does concurrency.group only deduplicate runs when the computed group string is identical?
💡 Result:
Yes, pushing to a branch with an open pull request triggers two separate workflow runs for a workflow that listens to both push and pull_request events: one for the push event (on the source branch) and one for the pull_request event (specifically the synchronize activity type). Yes, concurrency.group only deduplicates (queues or cancels) runs when the computed group string is identical (case-insensitive). Different strings result in separate concurrency groups with no interaction.
Citations:
- 1: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
- 2: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/triggering-a-workflow
- 3: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/control-the-concurrency-of-workflows-and-jobs
- 4: https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/control-workflow-concurrency
- 5: https://adamj.eu/tech/2025/05/14/github-actions-avoid-simple-on/
- 6: https://stackoverflow.com/questions/75714742/do-not-trigger-github-action-workflow-on-push-if-a-pr-is-open-on-the-branch
- 7: https://stackoverflow.com/questions/72203190/github-workflow-says-only-run-on-pull-request-why-does-it-run-when-code-is-push
- 8: https://stackoverflow.com/questions/65093647/in-github-actions-how-can-i-trigger-on-push-but-only-if-a-pr-is-active/65096459
Use one concurrency key for both push and pull_request runs.
Pushing to a changeset-release/** branch with an open PR triggers both push and pull_request events. The current key resolves to the PR number for pull_request runs and the full ref for push runs, preventing cancel-in-progress from deduplicating them.
🛠 Suggested change
concurrency:
- group: preview-build-${{ github.event.pull_request.number || github.ref }}
+ group: preview-build-${{ github.event.pull_request.head.repo.full_name || github.repository }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| concurrency: | |
| group: preview-build-${{ github.event.pull_request.number }} | |
| group: preview-build-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| concurrency: | |
| group: preview-build-${{ github.event.pull_request.head.repo.full_name || github.repository }}-${{ github.head_ref || github.ref_name }} | |
| cancel-in-progress: true |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/build-preview.yml around lines 10 - 12, The concurrency
group key must be the same for push and pull_request runs; replace the current
expression so it uses the branch name from the PR when present and falls back to
the push ref otherwise — update the concurrency.group expression (the group
under the concurrency block) to use github.event.pull_request.head.ref ||
github.ref (or equivalent head ref property) so both push and pull_request for
the same branch produce the same key and cancel-in-progress works.
Signed-off-by: itvi-1234 <rjsumit71@gmail.com>
Signed-off-by: itvi-1234 <rjsumit71@gmail.com>
|
@coderabbitai configuration |
|
Configuration used: defaults CodeRabbit configurationlanguage: en-US
tone_instructions: ''
early_access: false
enable_free_tier: true
inheritance: false
reviews:
profile: chill
request_changes_workflow: false
high_level_summary: true
high_level_summary_instructions: ''
high_level_summary_placeholder: '@coderabbitai summary'
high_level_summary_in_walkthrough: false
auto_title_placeholder: '@coderabbitai'
auto_title_instructions: ''
review_status: true
review_details: false
commit_status: true
fail_commit_status: false
collapse_walkthrough: true
changed_files_summary: true
sequence_diagrams: true
estimate_code_review_effort: true
assess_linked_issues: true
related_issues: true
related_prs: true
suggested_labels: true
labeling_instructions: []
auto_apply_labels: false
suggested_reviewers: true
auto_assign_reviewers: false
in_progress_fortune: true
poem: true
enable_prompt_for_ai_agents: true
path_filters: []
path_instructions: []
abort_on_close: true
disable_cache: false
slop_detection:
enabled: true
auto_review:
enabled: true
description_keyword: ''
auto_incremental_review: true
auto_pause_after_reviewed_commits: 5
ignore_title_keywords: []
labels: []
drafts: false
base_branches: []
ignore_usernames: []
finishing_touches:
docstrings:
enabled: true
unit_tests:
enabled: true
simplify:
enabled: false
custom: []
pre_merge_checks:
override_requested_reviewers_only: false
docstrings:
mode: warning
threshold: 80
title:
mode: warning
requirements: ''
description:
mode: warning
issue_assessment:
mode: warning
custom_checks: []
tools:
ast-grep:
rule_dirs: []
util_dirs: []
essential_rules: true
packages: []
shellcheck:
enabled: true
ruff:
enabled: true
markdownlint:
enabled: true
github-checks:
enabled: true
timeout_ms: 90000
languagetool:
enabled: true
enabled_rules: []
disabled_rules: []
enabled_categories: []
disabled_categories: []
enabled_only: false
level: default
biome:
enabled: true
hadolint:
enabled: true
swiftlint:
enabled: true
phpstan:
enabled: true
level: default
phpmd:
enabled: true
phpcs:
enabled: true
golangci-lint:
enabled: true
yamllint:
enabled: true
gitleaks:
enabled: true
trufflehog:
enabled: true
checkov:
enabled: true
tflint:
enabled: true
detekt:
enabled: true
eslint:
enabled: true
flake8:
enabled: true
fortitudeLint:
enabled: true
rubocop:
enabled: true
buf:
enabled: true
regal:
enabled: true
actionlint:
enabled: true
pmd:
enabled: true
clang:
enabled: true
cppcheck:
enabled: true
opengrep:
enabled: true
semgrep:
enabled: true
circleci:
enabled: true
clippy:
enabled: true
sqlfluff:
enabled: true
trivy:
enabled: true
prismaLint:
enabled: true
pylint:
enabled: true
oxc:
enabled: true
shopifyThemeCheck:
enabled: true
luacheck:
enabled: true
brakeman:
enabled: true
dotenvLint:
enabled: true
htmlhint:
enabled: true
stylelint:
enabled: true
checkmake:
enabled: true
osvScanner:
enabled: true
blinter:
enabled: true
smartyLint:
enabled: true
emberTemplateLint:
enabled: true
psscriptanalyzer:
enabled: true
chat:
art: true
allow_non_org_members: true
auto_reply: true
integrations:
jira:
usage: auto
linear:
usage: auto
knowledge_base:
opt_out: false
web_search:
enabled: true
code_guidelines:
enabled: true
filePatterns: []
learnings:
scope: auto
issues:
scope: auto
jira:
usage: auto
project_keys: []
linear:
usage: auto
team_keys: []
pull_requests:
scope: auto
mcp:
usage: auto
disabled_servers: []
linked_repositories: []
code_generation:
docstrings:
language: en-US
path_instructions: []
unit_tests:
path_instructions: []
issue_enrichment:
auto_enrich:
enabled: false
planning:
enabled: true
auto_planning:
enabled: true
labels: []
labeling:
labeling_instructions: []
auto_apply_labels: false
|
Changes:
1.Updated Triggers: Added push event support for the changeset-release/** branch pattern in build-preview.yml.
2.Dynamic PR Identification: Added a step using GitHub CLI (gh pr list) to correctly identify the Pull Request number when the workflow is triggered by a push event.
3.Concurrency Optimization: Refined the concurrency group to use github.ref as a fallback, ensuring that multiple rapid updates to the same branch cancel previous redundant builds.
Summary by CodeRabbit