Skip to content

Commit 488a90a

Browse files
Pigbibicodex
andauthored
fix: harden Dependabot automation (#123)
* fix: harden Dependabot automation Co-Authored-By: Codex <noreply@openai.com> * fix: retain disabled workflow tombstone Co-Authored-By: Codex <noreply@openai.com> --------- Co-authored-by: Codex <noreply@openai.com>
1 parent 1a5442d commit 488a90a

4 files changed

Lines changed: 15 additions & 6 deletions

File tree

.github/CODEOWNERS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
* @Pigbibi
1+
# Strategy decisions and execution entrypoints require owner visibility.
2+
/src/crypto_strategies/entrypoints/ @Pigbibi
3+
/src/crypto_strategies/strategies/ @Pigbibi

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ updates:
1818
- dependency-name: "*"
1919
update-types:
2020
- "version-update:semver-major"
21+
- dependency-name: "QuantStrategyLab/QuantPlatformKit/.github/workflows/reusable-drift-check.yml"

.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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Dismiss Dependabot Review Request
22

3+
# Disabled tombstone: automatic cleanup cannot retract an already-sent review notification.
34
"on":
4-
pull_request_target:
5-
types: [review_requested]
5+
workflow_dispatch:
66

77
permissions:
88
contents: read

0 commit comments

Comments
 (0)