Skip to content

Commit 66600c9

Browse files
Pigbibicodex
andcommitted
fix: harden Dependabot automation
Co-Authored-By: Codex <noreply@openai.com>
1 parent e39a53f commit 66600c9

3 files changed

Lines changed: 15 additions & 55 deletions

File tree

.github/CODEOWNERS

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
* @Pigbibi
1+
# Limit automatic review requests to order and risk-sensitive source changes.
2+
/src/quant_platform_kit/risk/ @Pigbibi
3+
/src/quant_platform_kit/binance/ @Pigbibi
4+
/src/quant_platform_kit/ibkr/ @Pigbibi
5+
/src/quant_platform_kit/longbridge/ @Pigbibi
6+
/src/quant_platform_kit/schwab/ @Pigbibi

.github/workflows/dependabot_auto_merge.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4444
run: |
4545
set -euo pipefail
46-
gh pr view "${{ steps.pr.outputs.pr_number }}" --repo "${GITHUB_REPOSITORY}" --json number,isDraft,author,url,body,labels > pr.json
46+
gh pr view "${{ steps.pr.outputs.pr_number }}" --repo "${GITHUB_REPOSITORY}" --json number,isDraft,author,url,title,body,labels > pr.json
4747
python3 - <<'PY'
4848
import json
4949
import os
@@ -52,15 +52,20 @@ jobs:
5252
pr = json.loads(Path("pr.json").read_text(encoding="utf-8"))
5353
author = (pr.get("author") or {}).get("login")
5454
labels = {item.get("name", "") for item in pr.get("labels", [])}
55+
title = pr.get("title") or ""
5556
body = pr.get("body") or ""
5657
is_major = "update-type: version-update:semver-major" in body
58+
sensitive_labels = {"docker", "github_actions"}
59+
is_sensitive = bool(labels & sensitive_labels) or "QuantStrategyLab/" in title or "QuantStrategyLab/" in body
5760
dependabot_authors = {"dependabot[bot]", "app/dependabot"}
5861
is_dependabot = author in dependabot_authors and "dependencies" in labels
59-
should_merge = is_dependabot and not pr.get("isDraft") and not is_major
62+
should_merge = is_dependabot and not pr.get("isDraft") and not is_major and not is_sensitive
6063
if should_merge:
6164
reason = "ready"
6265
elif is_major:
6366
reason = "major_update"
67+
elif is_sensitive:
68+
reason = "sensitive_dependency_update"
6469
else:
6570
reason = "not_eligible_dependabot_pr"
6671
@@ -71,6 +76,7 @@ jobs:
7176
f"- Draft: `{'yes' if pr.get('isDraft') else 'no'}`",
7277
f"- Dependabot label: `{'yes' if 'dependencies' in labels else 'no'}`",
7378
f"- Major update: `{'yes' if is_major else 'no'}`",
79+
f"- Sensitive dependency class: `{'yes' if is_sensitive else 'no'}`",
7480
f"- Final merge decision: `{'merge' if should_merge else 'skip'}`",
7581
f"- Reason: `{reason}`",
7682
]
@@ -88,4 +94,4 @@ jobs:
8894
if: steps.merge_guard.outputs.should_merge == 'true'
8995
env:
9096
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91-
run: gh pr merge "${{ steps.pr.outputs.pr_number }}" --repo "${GITHUB_REPOSITORY}" --rebase --delete-branch --match-head-commit "${{ steps.pr.outputs.head_sha }}"
97+
run: gh pr merge "${{ steps.pr.outputs.pr_number }}" --repo "${GITHUB_REPOSITORY}" --auto --rebase --delete-branch --match-head-commit "${{ steps.pr.outputs.head_sha }}"

.github/workflows/dependabot_review_request_cleanup.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)