Skip to content

fix(ci): trigger deploy-preview on Release PR updates#287

Open
itvi-1234 wants to merge 4 commits into
ioflux-org:mainfrom
itvi-1234:fix-preview-workflow
Open

fix(ci): trigger deploy-preview on Release PR updates#287
itvi-1234 wants to merge 4 commits into
ioflux-org:mainfrom
itvi-1234:fix-preview-workflow

Conversation

@itvi-1234

@itvi-1234 itvi-1234 commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

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

  • Chores
    • Improved build preview workflow reliability by enhancing PR number detection across event types.
    • Tightened concurrency control to avoid undefined states and conflicts across different triggers.
    • Added a changeset to mark the json-schema-studio package for a patch release related to preview deployment improvements.

…dates

Signed-off-by: itvi-1234 <rjsumit71@gmail.com>
Signed-off-by: itvi-1234 <rjsumit71@gmail.com>
@coderabbitai

coderabbitai Bot commented Apr 5, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f5c760ae-561d-4f41-baed-da3078215094

📥 Commits

Reviewing files that changed from the base of the PR and between e8db1d1 and 62f0cea.

📒 Files selected for processing (2)
  • .changeset/flat-llamas-serve.md
  • .github/workflows/build-preview.yml
✅ Files skipped from review due to trivial changes (1)
  • .changeset/flat-llamas-serve.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/build-preview.yml

📝 Walkthrough

Walkthrough

Workflow 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 gh pr list), and the computed PR number is written to pr_number.txt. Added a changeset for a patch release.

Changes

Cohort / File(s) Summary
CI Workflow
.github/workflows/build-preview.yml
Updated push-branch trigger to quoted changeset-release/**; changed concurrency group key to `preview-build-${{ github.event.pull_request.head.repo.full_name
Release metadata
.changeset/flat-llamas-serve.md
Added a changeset marking json-schema-studio for a patch release with a short description about preview deployment workflow improvements.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Poem

🐰
A branch hopped in with no PR sign,
I sniffed with gh and found its line.
Now previews bloom where once they stalled—
Happy hops, the pipeline's called! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description covers key changes but does not follow the repository template structure with required sections like Summary, What kind of change, Issue Number, etc. Restructure the description to match the template: add a Summary section, specify the type of change, include the issue number with Closes # reference, and confirm if documentation was updated.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: enabling the deploy-preview workflow to trigger on Release PR updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@itvi-1234
itvi-1234 marked this pull request as draft April 5, 2026 12:56
@github-actions

github-actions Bot commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

Preview Deployed!

Item Status
Latest Deploy Visit Preview
Environment Preview (PR-287)
Action View Logs

Last updated at 2026-04-05T13:16:39Z

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between a173afb and e8db1d1.

📒 Files selected for processing (1)
  • .github/workflows/build-preview.yml

Comment on lines 10 to 12
concurrency:
group: preview-build-${{ github.event.pull_request.number }}
group: preview-build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 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:


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.

Suggested change
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.

Comment thread .github/workflows/build-preview.yml
Signed-off-by: itvi-1234 <rjsumit71@gmail.com>
Signed-off-by: itvi-1234 <rjsumit71@gmail.com>
@itvi-1234
itvi-1234 marked this pull request as ready for review April 5, 2026 13:19
@itvi-1234
itvi-1234 marked this pull request as draft April 5, 2026 13:26
@itvi-1234
itvi-1234 marked this pull request as ready for review April 6, 2026 08:00
@itvi-1234

Copy link
Copy Markdown
Contributor Author

@coderabbitai configuration

@coderabbitai

coderabbitai Bot commented Apr 6, 2026

Copy link
Copy Markdown

Configuration used: defaults

CodeRabbit configuration
language: 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

@itvi-1234
itvi-1234 marked this pull request as draft April 6, 2026 08:00
@itvi-1234
itvi-1234 marked this pull request as ready for review April 13, 2026 08:27
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.

1 participant