Skip to content

Merge PRs after all CI passed#288

Merged
5ouma merged 1 commit intomainfrom
ci-ci-checker-merge-pr
Aug 26, 2025
Merged

Merge PRs after all CI passed#288
5ouma merged 1 commit intomainfrom
ci-ci-checker-merge-pr

Conversation

@5ouma
Copy link
Owner

@5ouma 5ouma commented Aug 26, 2025

⚠️ Issue

close #


✏️ Description

With this, no need to enable auto-merge.


With this, no need to enable auto-merge.
Copilot AI review requested due to automatic review settings August 26, 2025 13:13
@github-actions github-actions bot added the 🎽 CI Changes to CI configuration files and scripts label Aug 26, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces the standalone merge gatekeeper workflow with a combined CI checker workflow that both validates PR status and automatically merges specific bot PRs after all checks pass.

  • Removes the dedicated merge-gatekeeper.yml workflow file
  • Creates a new ci-checker.yml workflow that incorporates the merge gatekeeper functionality
  • Adds automatic PR merging for renovate[bot] PRs when triggered by autofix-ci[bot] and no reviewers are requested

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/merge-gatekeeper.yml Removed standalone merge gatekeeper workflow
.github/workflows/ci-checker.yml New combined workflow with gatekeeper and auto-merge functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@coderabbitai
Copy link

coderabbitai bot commented Aug 26, 2025

Walkthrough

Introduces a new workflow .github/workflows/ci-checker.yml with two jobs: a merge gatekeeper using upsidr/merge-gatekeeper and a conditional auto squash-merge for Renovate/autofix PRs. Removes the previous .github/workflows/merge-gatekeeper.yml workflow.

Changes

Cohort / File(s) Summary
Add CI checker workflow
.github/workflows/ci-checker.yml
Adds workflow "✅ CI Checker" on pull_request with two jobs: merge-gatekeeper (uses upsidr/merge-gatekeeper with checks/statuses read perms, ignores CodeRabbit PRs) and merge-pr (conditional squash merge via gh for Renovate + autofix-ci[bot] PRs without requested reviewers).
Remove legacy gatekeeper workflow
.../workflows/merge-gatekeeper.yml
Deletes prior "🛡️ Merge Gatekeeper" workflow that ran upsidr/merge-gatekeeper on pull_request.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ci-ci-checker-merge-pr

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (7)
.github/workflows/ci-checker.yml (7)

14-14: Normalize runner label to canonical value.

GitHub docs use ubuntu-latest (lowercase). While labels may be case-insensitive, standardizing reduces surprises and avoids linter noise.

Apply this diff:

-    runs-on: Ubuntu-Latest
+    runs-on: ubuntu-latest

…and likewise for the second job:

-    runs-on: Ubuntu-Latest
+    runs-on: ubuntu-latest

Also applies to: 32-32


11-15: Gatekeeper job may need pull-requests: read.

Some gatekeeper actions inspect PR metadata (draft state, reviews, etc.). If upsidr/merge-gatekeeper needs PR context, add pull-requests: read to avoid permission denials under the workflow’s restrictive defaults.

Proposed change:

     permissions:
       checks: read
       statuses: read
+      pull-requests: read

If unnecessary, feel free to skip—just flagging in case the action relies on PR fields.


15-15: Gatekeeper timeout may be too short.

If your CI regularly exceeds 10 minutes, the gatekeeper can time out before all checks settle. Consider 20–30 minutes to be safe.

-    timeout-minutes: 10
+    timeout-minutes: 30

25-33: Auto-merge guardrail improvements (draft, teams, base branch).

The current if: misses team reviewers and draft status, and doesn’t constrain the base branch. Recommend tightening to avoid premature merges.

Apply this diff:

-    if: ${{ github.event.pull_request.user.login == 'renovate[bot]' && github.event.sender.login == 'autofix-ci[bot]' && toJson(github.event.pull_request.requested_reviewers) == '[]' }}
+    if: ${{ 
+      github.event.pull_request.user.login == 'renovate[bot]' &&
+      github.event.pull_request.base.ref == 'main' &&
+      github.event.pull_request.draft == false &&
+      length(github.event.pull_request.requested_reviewers) == 0 &&
+      length(github.event.pull_request.requested_teams) == 0 &&
+      (github.event.sender.login == 'autofix-ci[bot]' || github.event.sender.login == 'renovate[bot]')
+    }}

If you intentionally want to trigger only on autofix-ci[bot] events, keep that part as-is—just add the draft/teams/base checks.


33-33: Increase merge step timeout.

Merges plus branch deletion can exceed 60 seconds during API lag; suggest a small buffer.

-    timeout-minutes: 1
+    timeout-minutes: 5

35-39: Prefer merging by PR number and delete the branch post-merge.

Using GITHUB_HEAD_REF can be ambiguous for forks; merging by PR number is unambiguous. Deleting the head branch keeps things tidy.

-      - name: 🔀 Squash merge PR
-        run: gh pr merge --repo="$GITHUB_REPOSITORY" "$GITHUB_HEAD_REF" --squash
-        env:
-          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      - name: 🔀 Squash merge PR
+        run: gh pr merge --repo "$GITHUB_REPOSITORY" ${{ github.event.pull_request.number }} --squash --delete-branch
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Optionally add --auto if you want GH to wait for checks itself and merge when ready (gatekeeper already enforces this, so not strictly needed).


3-5: Add workflow concurrency to prevent duplicate merges.

If multiple PR events fire close together (e.g., synchronize + label), you can serialize runs per-PR to avoid racing the merge.

 on:
   pull_request:
 
+concurrency:
+  group: ci-checker-pr-${{ github.event.pull_request.number }}
+  cancel-in-progress: true

If you prefer job-scoped concurrency, add the same block under the merge-pr job instead.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bd26376 and 77bb507.

📒 Files selected for processing (2)
  • .github/workflows/ci-checker.yml (1 hunks)
  • .github/workflows/merge-gatekeeper.yml (0 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/merge-gatekeeper.yml
🔇 Additional comments (3)
.github/workflows/ci-checker.yml (3)

6-6: Good use of restrictive default permissions.

Setting permissions: {} at workflow level and granting minimal, job-scoped permissions is a solid security posture.


18-24: Verify the “ignored” actor name.

ignored: CodeRabbit might not match the actual bot login (often ends with [bot]). Confirm the exact login(s) you intend to ignore; otherwise, the filter won’t apply.

Would you like me to look up the exact bot account(s) used in this repo’s PRs and propose the precise values?


19-23: Pinned action by commit — great.

Pinning upsidr/merge-gatekeeper to a commit SHA with an inline version comment is a good supply-chain practice.

@5ouma 5ouma merged commit b7aabbb into main Aug 26, 2025
10 checks passed
@5ouma 5ouma deleted the ci-ci-checker-merge-pr branch August 26, 2025 13:20
@5ouma 5ouma bot mentioned this pull request Aug 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🎽 CI Changes to CI configuration files and scripts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants