@@ -21,21 +21,30 @@ jobs:
21
21
env :
22
22
PR_URL : ${{github.event.pull_request.html_url}}
23
23
GITHUB_TOKEN : ${{secrets.PANORAMA_BOT_RW_TOKEN}}
24
+ - name : Add the Needs QA label to dependabots after any change by someone other than the dependabot bot
25
+ # Need to avoid the situation where someone removes the "Needs QA" label and we are adding it back.
26
+ if : ${{ github.actor != 'dependabot[bot]' && github.event.action != 'labeled' }}
27
+ run : gh pr edit "$PR_URL" --add-label "Needs QA"
28
+ env :
29
+ PR_URL : ${{github.event.pull_request.html_url}}
30
+ GITHUB_TOKEN : ${{secrets.PANORAMA_BOT_RW_TOKEN}}
31
+ - name : Fetch Dependabot metadata
32
+ if : ${{ github.actor == 'dependabot[bot]' }}
33
+ id : dependabot-metadata
34
+ uses :
dependabot/[email protected]
35
+ with :
36
+ github-token : " ${{ secrets.GITHUB_TOKEN }}"
24
37
- name : Approve and merge Dependabot PRs for development dependencies
25
38
# Auto-merge the PR if either:
26
39
# a) it has the `development-dependencies` label, which we add for certain
27
40
# categories of PRs (see `.github/dependabot.yml`), OR
28
41
# b) Dependabot has categorized it as a `direct:development` dependency,
29
- # meaning it's in the Gemfile in a `development` or `test` group
30
- #
31
- # Note that we also do nothing when the PR has already had auto-merge
32
- # enabled, to prevent scenarios where this check runs many times (for
33
- # instance, because removing `Needs QA` triggers another run, or because
34
- # other PRs are merging and causing this to rebase and trigger another
35
- # run) and then approves the PR many times, which is confusing and looks
36
- # awkward.
37
- if : ${{ github.actor == 'dependabot[bot]' && !github.event.pull_request.auto_merge }}
38
- run : gh pr merge --auto --merge "$PR_URL" && gh pr review --approve "$PR_URL"
42
+ # meaning it's in the Gemfile in a `development` or `test` group, OR
43
+ # c) our scripts have flagged the PR as an automergeable dependency (i.e
44
+ # a stable dependency with good unit test coverage) that has passed
45
+ # the waiting period.
46
+ if : ${{ (github.actor == 'dependabot[bot]' || github.actor == 'panorama-bot-r') && steps.unique-committers.outputs.committers == '["dependabot[bot]"]' && (contains(github.event.pull_request.labels.*.name, 'development-dependencies') || steps.dependabot-metadata.outputs.dependency-type == 'direct:development' || contains(github.event.pull_request.labels.*.name, 'automerge-dependencies')) }}
47
+ run : gh pr merge --auto --merge "$PR_URL" && gh pr edit "$PR_URL" --remove-label "Needs QA" && gh pr review --approve "$PR_URL"
39
48
env :
40
49
PR_URL : ${{github.event.pull_request.html_url}}
41
50
GITHUB_TOKEN : ${{secrets.PANORAMA_BOT_RW_TOKEN}}
0 commit comments