Skip to content

ci(ai-validation): skip prepare on Mergify-authored PRs#2043

Merged
andamasov merged 1 commit into
rollingfrom
yuriy/ai-validation-skip-prepare-on-bot-author
May 14, 2026
Merged

ci(ai-validation): skip prepare on Mergify-authored PRs#2043
andamasov merged 1 commit into
rollingfrom
yuriy/ai-validation-skip-prepare-on-bot-author

Conversation

@andamasov
Copy link
Copy Markdown
Member

@andamasov andamasov commented May 14, 2026

Summary

  • Lifts the existing Mergify-author short-circuit to a job-level if: on prepare, so the whole AI Validation pipeline skips for Mergify backport/queue PRs.
  • Fixes the fatal: FETCH_HEAD...HEAD: no merge base crash that occurs when a backport's merge ref shares no shallow ancestor with the (advanced) base branch — concrete example: run 25842928620 on vyos-documentation#2042 (sagitta backport of vyos-documentation#2023).

The validate-level skip in vyos-documentation@0e8a2956 was correct for the upstream claude-code-action rejecting bot-initiated runs, but fires too late — prepare has already run and crashed before validate's if: needs.prepare.outputs.has_md_changes == 'true' even evaluates.

Backport

  • circinus

(sagitta covered by direct hotfix vyos-documentation#2046 to unblock vyos-documentation#2042 immediately.)

Test plan

  • Once merged + auto-backported to circinus, future Mergify backports on circinus show prepare and validate skipped (not failing).
  • Human-authored PR on rolling still triggers prepare + validate normally.

🤖 Generated by robots

Lifts the existing Mergify-author short-circuit (today inside validate's
`secrets-check` step) to a job-level `if:` on `prepare`, so the whole
pipeline skips for backport/queue PRs.

Why now: every Mergify backport whose merge ref shares no shallow
ancestor with the (advanced) base branch fails the prepare step at

  git diff "$BASE...HEAD" --name-only ...
  fatal: FETCH_HEAD...HEAD: no merge base

(because base is `git fetch --no-tags --depth=1` and the merge ref is
`fetch-depth: 2`). Proximate symptom: run 25842928620 on PR #2042
(sagitta backport of #2023). AI Validation isn't a required check so
the queue isn't blocked, but every Mergify backport is left with a red
"prepare" check that adds noise to PR review.

The validate-level skip in commit 0e8a295 was correct for the
"claude-code-action rejects bot-initiated runs" failure mode but
fires too late — prepare has already run and crashed before validate's
`if: needs.prepare.outputs.has_md_changes == 'true'` even evaluates.

Implementation: single job-level `if:` on prepare. validate's
`needs: [prepare]` cascades the skip naturally (skipped needs make
the dependent's expression-based `if:` evaluate against empty outputs).
The in-step author check in validate stays as defense-in-depth.

🤖 Generated by [robots](https://vyos.io)
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: ca212132-54f9-407c-b912-8b1edbe7e03d

📥 Commits

Reviewing files that changed from the base of the PR and between 1e42eb3 and 7d94d61.

📒 Files selected for processing (1)
  • .github/workflows/ai-validation.yml

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Optimized CI/CD workflows by reducing unnecessary validation processing for automated pull requests, improving pipeline efficiency and reducing resource consumption.

Walkthrough

The PR adds a job-level if: condition to the prepare job in the AI validation workflow. When a PR is authored by Mergify (backport or queue operations), the job is skipped entirely, preventing execution of the expensive diff bundling step and avoiding failures on automated PR submissions.

Changes

AI Validation Workflow Guard

Layer / File(s) Summary
Prepare job guard for Mergify PRs
.github/workflows/ai-validation.yml
Lines 49–61 add a job-level if: condition that skips the prepare job when the PR author is mergify[bot], with explanatory comments.

Possibly related PRs

  • vyos/vyos-documentation#2027: Implements bot-author short-circuit via step outputs in the same workflow, addressing the same recurring prepare failures on Mergify-authored PRs.
  • vyos/vyos-documentation#1947: Introduces the prepare/validate workflow structure; this PR layers a Mergify-specific guard onto that foundation.
  • vyos/vyos-documentation#1968: Adds conditional skips in the same workflow based on whether documentation files changed, showing related job-gating patterns.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch yuriy/ai-validation-skip-prepare-on-bot-author

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.

@andamasov
Copy link
Copy Markdown
Member Author

@copilot review

Copy link
Copy Markdown
Contributor

Copilot AI commented May 14, 2026

@copilot review

Reviewed commit 7d94d61 and the referenced failed run (25842928620/job 75939332539). The failure is the expected pre-fix FETCH_HEAD...HEAD: no merge base in prepare, and this branch now passes AI Validation with the prepare job guard in place; no further changes are needed.

@andamasov andamasov marked this pull request as ready for review May 14, 2026 06:43
@andamasov andamasov merged commit ddee034 into rolling May 14, 2026
10 of 11 checks passed
@andamasov andamasov deleted the yuriy/ai-validation-skip-prepare-on-bot-author branch May 14, 2026 06:43
@vyosbot vyosbot added mirror-initiated This PR initiated for mirror sync workflow mirror-failed This PR mirror has failed and removed mirror-initiated This PR initiated for mirror sync workflow labels May 14, 2026
@andamasov
Copy link
Copy Markdown
Member Author

@mergify backport circinus sagitta

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 14, 2026

backport circinus sagitta

✅ Backports have been created

Details

andamasov added a commit that referenced this pull request May 14, 2026
ci(ai-validation): skip prepare on Mergify-authored PRs (backport #2043)
andamasov added a commit that referenced this pull request May 14, 2026
ci(ai-validation): skip prepare on Mergify-authored PRs (backport #2043)
@vyosbot vyosbot added mirror-initiated This PR initiated for mirror sync workflow and removed mirror-initiated This PR initiated for mirror sync workflow labels May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mirror-failed This PR mirror has failed

Development

Successfully merging this pull request may close these issues.

3 participants