File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments