|
1 | 1 | name: Dependabot conflict detector |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: [main] |
| 4 | + push: |
| 5 | + branches: [main] |
6 | 6 |
|
7 | 7 | permissions: |
8 | | - pull-requests: write |
| 8 | + pull-requests: write |
9 | 9 |
|
10 | 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 | | - }); |
| 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 | 23 |
|
24 | | - const dependabotPRs = pulls.filter(pr => pr.user.login === 'dependabot[bot]'); |
| 24 | + const dependabotPRs = pulls.filter(pr => pr.user.login === 'dependabot[bot]'); |
25 | 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 | | - } |
| 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 | + }); |
44 | 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 | + } |
0 commit comments