Skip to content

Commit 48373c0

Browse files
Add comment when dependabot gets stale to recreate
1 parent 0cc7393 commit 48373c0

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Dependabot conflict detector
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
pull-requests: write
9+
10+
jobs:
11+
check-conflicts:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check Dependabot PRs for conflicts
15+
uses: actions/github-script@v7
16+
with:
17+
script: |
18+
const { data: pulls } = await github.rest.pulls.list({
19+
owner: context.repo.owner,
20+
repo: context.repo.repo,
21+
state: 'open',
22+
});
23+
24+
const dependabotPRs = pulls.filter(pr => pr.user.login === 'dependabot[bot]');
25+
26+
for (const pr of dependabotPRs) {
27+
// Fetch full PR to get accurate mergeable status
28+
const { data: fullPR } = await github.rest.pulls.get({
29+
owner: context.repo.owner,
30+
repo: context.repo.repo,
31+
pull_number: pr.number,
32+
});
33+
34+
if (fullPR.mergeable === false) {
35+
await github.rest.issues.createComment({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
issue_number: pr.number,
39+
body: '@dependabot recreate',
40+
});
41+
console.log(`Requested recreate for PR #${pr.number}`);
42+
}
43+
}
44+

0 commit comments

Comments
 (0)