Skip to content

Fix auto-merge workflow#1398

Merged
shm11C3 merged 2 commits into
developfrom
fix/automerge-workflow
Apr 27, 2026
Merged

Fix auto-merge workflow#1398
shm11C3 merged 2 commits into
developfrom
fix/automerge-workflow

Conversation

@shm11C3

@shm11C3 shm11C3 commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Updated the auto-merge workflow to enhance eligibility checks and streamline approval processes for specific bots.

Summary

Related Issues

Type of Change

  • Bug fix (fix/ branch)
  • New feature (feat/ branch)
  • Refactoring (refactor/ branch)
  • Documentation (docs/ branch)
  • Dependencies update
  • Other (chore/ branch)

Screenshots / Videos

Test Plan

  • Manual testing
  • Unit tests

Checklist

  • Self-reviewed the code
  • Linting and formatting pass (npm run lint && npm run format / cargo tauri-lint && cargo tauri-fmt)
  • Tests pass (npm test / cargo tauri-test)
  • No new warnings or errors

Summary by CodeRabbit

  • Chores
    • Refined automated pull request workflow with tighter gating and eligibility checks for auto-merge, stricter conditions for bot-generated PRs, improved handling of dependency updates, and more secure metadata and approval gating to reduce unintended merges.

Updated the auto-merge workflow to enhance eligibility checks and streamline approval processes for specific bots.
Copilot AI review requested due to automatic review settings April 27, 2026 13:32
@coderabbitai

coderabbitai Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 7c7c2d60-afde-448b-80e1-3523ef4b65b3

📥 Commits

Reviewing files that changed from the base of the PR and between 2dba7fe and 9f17424.

📒 Files selected for processing (1)
  • .github/workflows/auto-merge.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/auto-merge.yml

📝 Walkthrough

Walkthrough

The auto-merge GitHub Actions workflow is changed to run on pull_request_target for specific PR events, adds job-level guards to run only for non-draft PRs from authorized bots targeting the same repo, and introduces a single eligibility step that gates GitHub App token creation, PR approval, and enabling auto-merge based on author and Dependabot metadata.

Changes

Cohort / File(s) Summary
GitHub Actions workflow
.github/workflows/auto-merge.yml
Switched trigger to pull_request_target with explicit event types; added job-level if to ensure same-repo, non-draft, authorized-bot authors; added Check auto-merge eligibility step producing enabled output (bot-author always eligible; Dependabot eligible only for version-update:semver-patch); replaced inline author/update-type gating with steps.eligibility.outputs.enabled; fetches Dependabot metadata using ${{ github.token }} and gates GitHub App token generation, PR approval, and auto-merge on eligibility.

Sequence Diagram(s)

sequenceDiagram
  participant PR as PR (pull_request_target)
  participant Workflow as GitHub Actions Workflow
  participant GHMeta as GitHub API (metadata)
  participant App as GitHub App (token)
  participant Actions as Approval / Auto-merge

  PR->>Workflow: trigger on PR events
  Workflow->>GHMeta: fetch PR & Dependabot metadata (uses github.token)
  GHMeta-->>Workflow: returns author/update-type
  Workflow->>Workflow: evaluate eligibility (bot check, dependabot update-type)
  alt eligible
    Workflow->>App: generate GitHub App token (app auth)
    App-->>Workflow: app_token
    Workflow->>Actions: approve PR (use app_token)
    Actions-->>Workflow: approval result
    Workflow->>Actions: enable auto-merge
    Actions-->>Workflow: enabled
  else not eligible
    Workflow-->>PR: skip approval/auto-merge
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I hopped through YAML lines tonight,
Checking bots and metadata bright,
A single gate decides the flow,
Tokens, approvals — ready to go! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description template sections are present but largely empty; key sections like Summary, Related Issues, Type of Change, and Test Plan lack substantive content or selections. Complete the Summary section explaining why changes were needed, select the appropriate Type of Change, link any related issues, and describe how the workflow was tested.
Title check ❓ Inconclusive The title 'Fix auto-merge workflow' is a vague, generic phrase that does not clearly convey what specific issue was fixed or what the main change accomplishes. Clarify the title with specifics (e.g., 'Tighten auto-merge eligibility checks for bot PRs' or 'Restrict auto-merge workflow to pull_request_target event')
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/automerge-workflow

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

@github-actions github-actions Bot added bug Something isn't working github_actions Pull requests that update GitHub Actions code labels Apr 27, 2026
@github-actions

github-actions Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 97.43% (🎯 60%) 1025 / 1052
🔵 Statements 96.88% (🎯 60%) 1088 / 1123
🔵 Functions 97% (🎯 60%) 259 / 267
🔵 Branches 89.84% (🎯 60%) 345 / 384
File CoverageNo changed files found.
Generated in workflow #2773 for commit 9f17424 by the Vitest Coverage Report Action

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the GitHub Actions auto-merge workflow to run in a safer pull_request_target context and to centralize eligibility logic for bot-authored PRs before auto-approving and enabling auto-merge.

Changes:

  • Switch workflow trigger from pull_request to pull_request_target with selected PR event types.
  • Add an explicit eligibility step to decide whether the PR should be approved/auto-merged (app bot always; Dependabot patch updates only).
  • Gate GitHub App token generation and subsequent gh approval/auto-merge steps behind the eligibility result.

Comment thread .github/workflows/auto-merge.yml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
.github/workflows/auto-merge.yml (2)

14-17: Add concurrency control for repeated PR events.

opened/synchronize can produce overlapping runs on the same PR. A concurrency group avoids redundant approvals/merge attempts and reduces noisy failures.

Suggested reliability diff
 jobs:
   auto-merge:
     name: Approve and enable auto-merge
     runs-on: ubuntu-latest
+    concurrency:
+      group: auto-merge-pr-${{ github.event.pull_request.number }}
+      cancel-in-progress: true
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/auto-merge.yml around lines 14 - 17, The auto-merge
workflow job "auto-merge" can run overlapping builds for the same PR; add a
GitHub Actions concurrency stanza to the workflow (at the job or workflow root)
that sets a group based on the pull request identifier (e.g., using
github.event.pull_request.number or github.ref) and enable cancel-in-progress:
true so concurrent runs for the same PR are serialized/canceled; update the
"auto-merge" job definition to include this concurrency group to prevent
redundant approvals/merge attempts.

3-9: Scope auto-merge to intended base branches explicitly.

Line 3 and Lines 22-29 don’t currently constrain base.ref, so this can run for bot PRs targeting any branch. If this is intended only for develop, add an explicit branch guard.

Suggested hardening diff
 on:
   pull_request_target:
+    branches:
+      - develop
     types:
       - opened
       - reopened
       - synchronize
       - ready_for_review

Also applies to: 22-29

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/auto-merge.yml around lines 3 - 9, The workflow trigger is
not scoped to a target branch so auto-merge can run for PRs to any branch; add
an explicit branch guard by adding a branches filter under
on.pull_request_target (e.g. branches: ['develop']) and also add runtime guards
where the job/step references github.event.pull_request.base.ref (use if:
github.event.pull_request.base.ref == 'develop') so the auto-merge logic only
runs for PRs targeting develop; update both the top-level trigger and the other
place that checks base.ref (the auto-merge job/steps) to include these checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/auto-merge.yml:
- Around line 14-17: The auto-merge workflow job "auto-merge" can run
overlapping builds for the same PR; add a GitHub Actions concurrency stanza to
the workflow (at the job or workflow root) that sets a group based on the pull
request identifier (e.g., using github.event.pull_request.number or github.ref)
and enable cancel-in-progress: true so concurrent runs for the same PR are
serialized/canceled; update the "auto-merge" job definition to include this
concurrency group to prevent redundant approvals/merge attempts.
- Around line 3-9: The workflow trigger is not scoped to a target branch so
auto-merge can run for PRs to any branch; add an explicit branch guard by adding
a branches filter under on.pull_request_target (e.g. branches: ['develop']) and
also add runtime guards where the job/step references
github.event.pull_request.base.ref (use if: github.event.pull_request.base.ref
== 'develop') so the auto-merge logic only runs for PRs targeting develop;
update both the top-level trigger and the other place that checks base.ref (the
auto-merge job/steps) to include these checks.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: ad91d9c4-1368-40b3-85ca-fba35d6a546d

📥 Commits

Reviewing files that changed from the base of the PR and between 4f2bf59 and 2dba7fe.

📒 Files selected for processing (1)
  • .github/workflows/auto-merge.yml

coderabbitai[bot]
coderabbitai Bot previously approved these changes Apr 27, 2026
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Rust Backend Coverage Report

Coverage Details
Filename                                         Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
_tests/commands/background_image_test.rs              39                 0   100.00%           6                 0   100.00%          21                 0   100.00%           0                 0         -
_tests/commands/settings_test.rs                     220                 0   100.00%          18                 0   100.00%         167                 0   100.00%           0                 0         -
commands/background_image.rs                          22                 7    68.18%          11                 5    54.55%          19                 7    63.16%           0                 0         -
commands/hardware.rs                                  66                66     0.00%          20                20     0.00%          66                66     0.00%           0                 0         -
commands/settings.rs                                 544               544     0.00%          97                97     0.00%         463               463     0.00%           0                 0         -
commands/system.rs                                     6                 6     0.00%           3                 3     0.00%           5                 5     0.00%           0                 0         -
commands/ui.rs                                        17                17     0.00%           2                 2     0.00%          13                13     0.00%           0                 0         -
commands/updater.rs                                   97                97     0.00%          15                15     0.00%          66                66     0.00%           0                 0         -
enums/error.rs                                       105                 0   100.00%           8                 0   100.00%          89                 0   100.00%           0                 0         -
enums/hardware.rs                                    188                 1    99.47%          15                 0   100.00%         114                 0   100.00%           0                 0         -
enums/settings.rs                                    415                 6    98.55%          24                 0   100.00%         279                 0   100.00%           0                 0         -
infrastructure/database/db.rs                         21                21     0.00%           2                 2     0.00%          12                12     0.00%           0                 0         -
infrastructure/database/gpu_archive.rs                51                51     0.00%           4                 4     0.00%          18                18     0.00%           0                 0         -
infrastructure/database/hardware_archive.rs           41                41     0.00%           4                 4     0.00%          21                21     0.00%           0                 0         -
infrastructure/database/migration.rs                  66                 1    98.48%          10                 0   100.00%          86                 0   100.00%           0                 0         -
infrastructure/database/preflight.rs                 288                13    95.49%          28                 1    96.43%         179                 7    96.09%           0                 0         -
infrastructure/database/process_stats.rs              41                41     0.00%           4                 4     0.00%          29                29     0.00%           0                 0         -
infrastructure/providers/linux/dmidecode.rs          229                15    93.45%          16                 3    81.25%         319                14    95.61%           0                 0         -
infrastructure/providers/linux/drm_sys.rs            205               156    23.90%          21                14    33.33%         126                93    26.19%           0                 0         -
infrastructure/providers/linux/hwmon.rs              119                94    21.01%           8                 6    25.00%          68                56    17.65%           0                 0         -
infrastructure/providers/linux/kernel.rs             165                22    86.67%          19                 2    89.47%         161                 8    95.03%           0                 0         -
infrastructure/providers/linux/lspci.rs               83                20    75.90%           8                 2    75.00%          50                11    78.00%           0                 0         -
infrastructure/providers/linux/net_sys.rs            171               171     0.00%          13                13     0.00%          93                93     0.00%           0                 0         -
infrastructure/providers/linux/procfs.rs             261                24    90.80%          25                 3    88.00%         222                19    91.44%           0                 0         -
infrastructure/providers/sysinfo_provider.rs          54                54     0.00%           2                 2     0.00%          45                45     0.00%           0                 0         -
lib.rs                                               247               247     0.00%           6                 6     0.00%         138               138     0.00%           0                 0         -
main.rs                                                3                 3     0.00%           1                 1     0.00%           3                 3     0.00%           0                 0         -
models/hardware.rs                                   292                 0   100.00%          19                 0   100.00%         175                 0   100.00%           0                 0         -
models/hardware_archive.rs                             3                 0   100.00%           1                 0   100.00%           7                 0   100.00%           0                 0         -
models/settings.rs                                   301                 0   100.00%          17                 0   100.00%         264                 0   100.00%           0                 0         -
platform/factory.rs                                   18                18     0.00%           4                 4     0.00%          15                15     0.00%           0                 0         -
platform/linux/cache.rs                               53                53     0.00%           4                 4     0.00%          38                38     0.00%           0                 0         -
platform/linux/gpu.rs                                143               143     0.00%          14                14     0.00%         105               105     0.00%           0                 0         -
platform/linux/memory.rs                              43                43     0.00%           6                 6     0.00%          41                41     0.00%           0                 0         -
platform/linux/mod.rs                                 34                34     0.00%          11                11     0.00%          70                70     0.00%           0                 0         -
platform/linux/network.rs                              4                 4     0.00%           1                 1     0.00%           4                 4     0.00%           0                 0         -
services/archive_service.rs                         1230               155    87.40%          93                15    83.87%         694               135    80.55%           0                 0         -
services/background_image_service.rs                 165                96    41.82%          16                10    37.50%          93                59    36.56%           0                 0         -
services/cpu_service.rs                               32                32     0.00%           4                 4     0.00%          15                15     0.00%           0                 0         -
services/db_startup_service.rs                       188                87    53.72%          10                 3    70.00%         114                58    49.12%           0                 0         -
services/gpu_service.rs                               37                37     0.00%          10                10     0.00%          31                31     0.00%           0                 0         -
services/hardware_service.rs                          67                67     0.00%           5                 5     0.00%          43                43     0.00%           0                 0         -
services/language_service.rs                         101                 0   100.00%          18                 0   100.00%          57                 0   100.00%           0                 0         -
services/memory_service.rs                            22                22     0.00%           4                 4     0.00%          15                15     0.00%           0                 0         -
services/monitoring_service.rs                      1114               161    85.55%          75                19    74.67%         574               104    81.88%           0                 0         -
services/motherboard_service.rs                       10                10     0.00%           3                 3     0.00%           7                 7     0.00%           0                 0         -
services/network_service.rs                            9                 9     0.00%           1                 1     0.00%           7                 7     0.00%           0                 0         -
services/process_service.rs                           86                86     0.00%           5                 5     0.00%          50                50     0.00%           0                 0         -
services/settings_service.rs                         338               158    53.25%          34                16    52.94%         288               148    48.61%           0                 0         -
services/system_service.rs                            22                22     0.00%           2                 2     0.00%          12                12     0.00%           0                 0         -
services/ui_service.rs                                45                45     0.00%           8                 8     0.00%          36                36     0.00%           0                 0         -
utils/color.rs                                        66                 1    98.48%           4                 0   100.00%          26                 0   100.00%           0                 0         -
utils/file.rs                                        224                 5    97.77%          14                 0   100.00%         144                 4    97.22%           0                 0         -
utils/formatter.rs                                   195                 8    95.90%          16                 0   100.00%         160                12    92.50%           0                 0         -
utils/ip.rs                                           65                 0   100.00%           5                 0   100.00%          33                 0   100.00%           0                 0         -
utils/logger.rs                                       71                71     0.00%           1                 1     0.00%          38                38     0.00%           0                 0         -
utils/rounding.rs                                     68                 0   100.00%           7                 0   100.00%          41                 0   100.00%           0                 0         -
utils/tauri.rs                                       138                 0   100.00%          17                 0   100.00%          82                 0   100.00%           0                 0         -
workers/hardware_archive.rs                           52                52     0.00%           6                 6     0.00%          36                36     0.00%           0                 0         -
workers/mod.rs                                        24                24     0.00%           2                 2     0.00%          16                16     0.00%           0                 0         -
workers/system_monitor.rs                            261                97    62.84%          18                 6    66.67%         150                66    56.00%           0                 0         -
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                               9285              3258    64.91%         845               369    56.33%        6353              2352    62.98%           0                 0         -

@shm11C3 shm11C3 enabled auto-merge (squash) April 27, 2026 13:36
@shm11C3 shm11C3 disabled auto-merge April 27, 2026 13:37
@shm11C3 shm11C3 merged commit 57d3a51 into develop Apr 27, 2026
26 checks passed
@shm11C3 shm11C3 deleted the fix/automerge-workflow branch April 27, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants