Skip to content

Commit 28843d3

Browse files
Pigbibicursoragent
andcommitted
chore: tighten numpy/scipy bounds and CI Python 3.12
Pin scipy/numpy upper bounds, ignore incompatible Dependabot bumps, upgrade CI to Python 3.12, and adopt Dependabot auto-merge gold standard. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 7bd9a3f commit 28843d3

4 files changed

Lines changed: 32 additions & 11 deletions

File tree

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ updates:
99
- dependency-name: "*"
1010
update-types:
1111
- "version-update:semver-major"
12+
- dependency-name: "scipy"
13+
versions: [">=1.18"]
14+
- dependency-name: "numpy"
15+
versions: [">=2.5"]
1216
- package-ecosystem: "github-actions"
1317
directory: "/"
1418
schedule:

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup Python
2121
uses: actions/setup-python@v6
2222
with:
23-
python-version: "3.11"
23+
python-version: "3.12"
2424

2525
- name: Install dependencies
2626
run: |

.github/workflows/dependabot_auto_merge.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,19 @@ jobs:
2222
run: |
2323
set -euo pipefail
2424
BRANCH_NAME="${{ github.event.workflow_run.head_branch }}"
25-
PR_NUMBER=$(gh pr list --repo "${GITHUB_REPOSITORY}" --state open --head "${BRANCH_NAME}" --json number --jq '.[0].number // empty')
25+
PR_PAYLOAD=$(gh pr list --repo "${GITHUB_REPOSITORY}" --state open --head "${BRANCH_NAME}" --json number,headRefOid --jq '.[0] // {}')
26+
PR_NUMBER=$(python3 -c 'import json,sys; print(json.load(sys.stdin).get("number", ""))' <<<"${PR_PAYLOAD}")
27+
PR_HEAD_SHA=$(python3 -c 'import json,sys; print(json.load(sys.stdin).get("headRefOid", ""))' <<<"${PR_PAYLOAD}")
2628
if [ -z "${PR_NUMBER}" ]; then
2729
echo "No open Dependabot PR found for ${BRANCH_NAME}." >> "$GITHUB_STEP_SUMMARY"
2830
exit 0
2931
fi
32+
if [ "${PR_HEAD_SHA}" != "${{ github.event.workflow_run.head_sha }}" ]; then
33+
echo "Skipping auto-merge: PR #${PR_NUMBER} head ${PR_HEAD_SHA} does not match completed CI head ${{ github.event.workflow_run.head_sha }}." >> "$GITHUB_STEP_SUMMARY"
34+
exit 0
35+
fi
3036
echo "pr_number=${PR_NUMBER}" >> "$GITHUB_OUTPUT"
37+
echo "head_sha=${PR_HEAD_SHA}" >> "$GITHUB_OUTPUT"
3138
3239
- name: Evaluate merge eligibility
3340
id: merge_guard
@@ -36,7 +43,7 @@ jobs:
3643
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3744
run: |
3845
set -euo pipefail
39-
gh pr view "${{ steps.pr.outputs.pr_number }}" --repo "${GITHUB_REPOSITORY}" --json number,isDraft,author,url,labels > pr.json
46+
gh pr view "${{ steps.pr.outputs.pr_number }}" --repo "${GITHUB_REPOSITORY}" --json number,isDraft,author,url,body,labels > pr.json
4047
python3 - <<'PY'
4148
import json
4249
import os
@@ -45,16 +52,26 @@ jobs:
4552
pr = json.loads(Path("pr.json").read_text(encoding="utf-8"))
4653
author = (pr.get("author") or {}).get("login")
4754
labels = {item.get("name", "") for item in pr.get("labels", [])}
48-
should_merge = author in {"dependabot[bot]", "app/dependabot"} and not pr.get("isDraft")
49-
reason = "ready" if should_merge else "not_dependabot_or_draft"
55+
body = pr.get("body") or ""
56+
is_major = "update-type: version-update:semver-major" in body
57+
dependabot_authors = {"dependabot[bot]", "app/dependabot"}
58+
is_dependabot = author in dependabot_authors and "dependencies" in labels
59+
should_merge = is_dependabot and not pr.get("isDraft") and not is_major
60+
if should_merge:
61+
reason = "ready"
62+
elif is_major:
63+
reason = "major_update"
64+
else:
65+
reason = "not_eligible_dependabot_pr"
5066
5167
summary_lines = [
5268
"## Auto-Merge Gate",
5369
f"- PR: {pr['url']}",
5470
f"- Author: `{author or '<unknown>'}`",
55-
f"- Draft: `{ 'yes' if pr.get('isDraft') else 'no' }`",
56-
f"- Dependabot label: `{ 'yes' if 'dependencies' in labels else 'no' }`",
57-
f"- Final merge decision: `{ 'merge' if should_merge else 'skip' }`",
71+
f"- Draft: `{'yes' if pr.get('isDraft') else 'no'}`",
72+
f"- Dependabot label: `{'yes' if 'dependencies' in labels else 'no'}`",
73+
f"- Major update: `{'yes' if is_major else 'no'}`",
74+
f"- Final merge decision: `{'merge' if should_merge else 'skip'}`",
5875
f"- Reason: `{reason}`",
5976
]
6077
Path("pr-summary.md").write_text("\n".join(summary_lines).strip() + "\n", encoding="utf-8")
@@ -71,4 +88,4 @@ jobs:
7188
if: steps.merge_guard.outputs.should_merge == 'true'
7289
env:
7390
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74-
run: gh pr merge "${{ steps.pr.outputs.pr_number }}" --repo "${GITHUB_REPOSITORY}" --rebase --delete-branch
91+
run: gh pr merge "${{ steps.pr.outputs.pr_number }}" --repo "${GITHUB_REPOSITORY}" --rebase --delete-branch --match-head-commit "${{ steps.pr.outputs.head_sha }}"

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
pandas>=3.0.3
2-
numpy>=2.4.6
2+
numpy>=2.4.6,<2.5
33
requests>=2.34.2
44
matplotlib>=3.11.0
55
PyYAML>=6.0
66
lightgbm>=4.3
77
scikit-learn>=1.9.0
8-
scipy>=1.11
8+
scipy>=1.11,<1.18
99
joblib>=1.3
1010
google-cloud-storage>=3.12.0
1111
google-cloud-firestore>=2.16

0 commit comments

Comments
 (0)