Skip to content

Commit d123157

Browse files
committed
Aggressively disable Dependabot preview deployments with multiple approaches
1 parent 5601fca commit d123157

5 files changed

Lines changed: 61 additions & 14 deletions

File tree

.github/dependabot.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,13 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "monthly"
7-
open-pull-requests-limit: 3
7+
# Disable automatic pull requests completely
8+
open-pull-requests-limit: 0
89
versioning-strategy: auto
910
labels:
1011
- "dependencies"
1112
- "security"
12-
# Only allow security updates to create PRs automatically
13-
# This will dramatically reduce the number of PRs
13+
# Ignore all updates to prevent any PRs
1414
ignore:
1515
- dependency-name: "*"
16-
update-types: ["version-update:semver-minor", "version-update:semver-patch"]
17-
# Group all non-major updates into a single PR
18-
groups:
19-
minor-patch-dependencies:
20-
patterns:
21-
- "*"
22-
update-types:
23-
- "minor"
24-
- "patch"
16+
update-types: ["version-update:semver-major", "version-update:semver-minor", "version-update:semver-patch"]
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Auto-close Dependabot PRs
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, reopened]
6+
7+
jobs:
8+
auto-close:
9+
runs-on: ubuntu-latest
10+
if: github.actor == 'dependabot[bot]'
11+
steps:
12+
- name: Close Pull Request
13+
uses: actions/github-script@v6
14+
with:
15+
github-token: ${{ secrets.GITHUB_TOKEN }}
16+
script: |
17+
const pr = context.payload.pull_request;
18+
console.log(`Auto-closing Dependabot PR #${pr.number}: ${pr.title}`);
19+
20+
await github.rest.issues.createComment({
21+
owner: context.repo.owner,
22+
repo: context.repo.repo,
23+
issue_number: pr.number,
24+
body: 'This Dependabot PR is being automatically closed to prevent unnecessary Vercel preview deployments. Security updates will be applied manually by the team.'
25+
});
26+
27+
await github.rest.pulls.update({
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
pull_number: pr.number,
31+
state: 'closed'
32+
});

.vercelignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Ignore Dependabot branches
2+
dependabot/*
3+
dependabot*

fix-vulnerabilities.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
# Script to fix vulnerabilities with force flag
4+
echo "Fixing vulnerabilities with force flag..."
5+
6+
# Run audit fix with force flag
7+
npm audit fix --force
8+
9+
# Check functions directory
10+
echo "Fixing vulnerabilities in functions directory..."
11+
cd functions
12+
npm audit fix --force --legacy-peer-deps
13+
14+
echo "Vulnerabilities fixed. Please check for any breaking changes."

vercel.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
},
77
"github": {
88
"silent": true,
9-
"autoJobCancelation": true
9+
"autoJobCancelation": true,
10+
"enabled": false
1011
},
11-
"ignoreCommand": "if [[ $VERCEL_GIT_COMMIT_REF == dependabot/* ]]; then exit 0; else exit 1; fi"
12+
"git": {
13+
"deploymentEnabled": {
14+
"dependabot": false
15+
}
16+
},
17+
"ignoreCommand": "if [[ $VERCEL_GIT_COMMIT_REF == *\"dependabot\"* ]]; then exit 0; else exit 1; fi"
1218
}

0 commit comments

Comments
 (0)