Skip to content

Commit 00034eb

Browse files
committed
Batch Dependabot PRs
Leverages https://github.com/Legal-and-General/dependabot-batcher to create and/or maintain a merged PR (and branch) of all the Dependabot PRs and close them as they are merged in, leaving a single Dependabot PR behind. The Dependabot schedule is set for Sunday at 9:00am and the batcher workflow is configured to run Sunday at 9:00pm. All workflows that run on pull requests open have been configured to ignore branches prefixed with `dependabot/`. Since the dependabot PRs are all going to be closed and batched there is no need to waste CI minutes on them. Any new workflows will require the same check to prevent running on dependabot PRs.
1 parent 213d4be commit 00034eb

18 files changed

+51
-3
lines changed

.github/dependabot.yml

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ updates:
44
directory: "/"
55
schedule:
66
interval: weekly
7+
day: "sunday"
8+
time: "09:00" # 9am UTC
79
ignore:
810
# Deprecated APIs, requires manual changes.
911
# TODO(xacrimon): Update Firestore and solve deprecations.
@@ -43,6 +45,8 @@ updates:
4345
directory: "/api"
4446
schedule:
4547
interval: weekly
48+
day: "sunday"
49+
time: "09:00" # 9am UTC
4650
ignore:
4751
# TODO(codingllama): Allow /x/crypto updates after upstream patch.
4852
- dependency-name: golang.org/x/crypto
@@ -58,6 +62,8 @@ updates:
5862
directory: "/"
5963
schedule:
6064
interval: weekly
65+
day: "sunday"
66+
time: "09:00" # 9am UTC
6167
open-pull-requests-limit: 10
6268
reviewers:
6369
- codingllama
@@ -68,6 +74,8 @@ updates:
6874
directory: "/lib/srv/desktop/rdp/rdpclient"
6975
schedule:
7076
interval: weekly
77+
day: "sunday"
78+
time: "09:00" # 9am UTC
7179
open-pull-requests-limit: 10
7280
reviewers:
7381
- codingllama

.github/workflows/assign.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ permissions:
3030
jobs:
3131
auto-request-review:
3232
name: Auto Request Review
33-
if: ${{ !github.event.pull_request.draft }}
33+
if: ${{ !github.event.pull_request.draft && !startsWith(github.head_ref, 'dependabot/') }}
3434
runs-on: ubuntu-latest
3535
steps:
3636
# Checkout main branch of shared-workflow repository.

.github/workflows/build-macos.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ on:
2929
jobs:
3030
build:
3131
name: Build on Mac OS
32+
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
3233
runs-on: macos-12 # TODO(r0mant): Update with large runner when it's available
3334

3435
permissions:

.github/workflows/build-windows.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ on:
2727
jobs:
2828
build:
2929
name: Build on Windows
30+
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
3031
runs-on: windows-2022-16core
3132

3233
permissions:

.github/workflows/check.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ permissions:
3232
jobs:
3333
check-reviews:
3434
name: Checking reviewers
35-
if: ${{ !github.event.pull_request.draft }}
35+
if: ${{ !github.event.pull_request.draft && !startsWith(github.head_ref, 'dependabot/') }}
3636
runs-on: ubuntu-latest
3737
steps:
3838
# Checkout main branch of shared-workflow repository.

.github/workflows/cifuzz.yml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ on:
1818

1919
jobs:
2020
fuzzing:
21+
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
2122
name: Fuzzing
2223
runs-on: ubuntu-22.04-32core
2324
permissions:

.github/workflows/codeql.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ on:
1717
jobs:
1818
analyze:
1919
name: Analyze
20+
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
2021
runs-on: ubuntu-22.04-32core
2122
permissions:
2223
actions: read
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This workflow combines all open Dependabot PRs into a single batched
2+
# PR, links all the Dependabot PRs to the new one, and closes all the
3+
# Dependabot PRs. The schedule is set to exactly 12 hours after the
4+
# Dependabot schedule.
5+
#
6+
# All workflows that run on PR should be skipped for Dependabot PRs
7+
# to prevent wasting CI cycles.
8+
name: 'Dependabot Batcher'
9+
on:
10+
workflow_dispatch:
11+
schedule:
12+
- cron: '0 21 * * 0' # At 9:00 PM every Sunday UTC
13+
14+
permissions:
15+
pull-requests: write
16+
contents: write
17+
18+
jobs:
19+
dependabot-batcher:
20+
name: 'Combine Dependabot PRs'
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: 'Dependabot Batcher'
24+
uses: Legal-and-General/[email protected]
25+
with:
26+
token: ${{ secrets.GITHUB_TOKEN }} #required
27+
baseBranchName: 'master'

.github/workflows/dependency-review.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55

66
jobs:
77
dependency-review:
8+
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
89
uses: gravitational/shared-workflows/.github/workflows/dependency-review.yaml@main
910
permissions:
1011
contents: read

.github/workflows/doc-tests.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
jobs:
1111
doc-tests:
1212
name: Lint (Docs)
13+
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
1314
runs-on: ubuntu-latest
1415

1516
permissions:

.github/workflows/integration-tests-non-root.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ on:
2323
jobs:
2424
test:
2525
name: Integration Tests (Non-root)
26+
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
2627
runs-on: ubuntu-22.04-16core
2728

2829
permissions:

.github/workflows/integration-tests-root.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ on:
2323
jobs:
2424
test:
2525
name: Integration Tests (Root)
26+
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
2627
runs-on: ubuntu-22.04-16core
2728

2829
permissions:

.github/workflows/label.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ permissions:
3030
jobs:
3131
auto-label-pr:
3232
name: Label Pull Request
33-
if: ${{ !github.event.pull_request.draft }}
33+
if: ${{ !github.event.pull_request.draft && !startsWith(github.head_ref, 'dependabot/') }}
3434
runs-on: ubuntu-latest
3535
steps:
3636
# Checkout main branch of shared-workflow repository.

.github/workflows/lint.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99

1010
jobs:
1111
lint:
12+
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
1213
name: Lint (Go)
1314
runs-on: ubuntu-22.04-16core
1415

.github/workflows/os-compatibility-test.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
jobs:
1111
build:
1212
name: OS Compatibility Build
13+
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
1314
runs-on: ubuntu-22.04-16core
1415

1516
permissions:

.github/workflows/unit-tests-code.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ on:
2323
jobs:
2424
test:
2525
name: Unit Tests (Go)
26+
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
2627
runs-on: ubuntu-22.04-32core
2728

2829
permissions:

.github/workflows/unit-tests-operator.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ on:
2727
jobs:
2828
test:
2929
name: Unit Tests (Operator)
30+
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
3031
runs-on: ubuntu-22.04-16core
3132

3233
permissions:

.github/workflows/unit-tests-rust.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ on:
2323
jobs:
2424
test:
2525
name: Unit Tests (Rust)
26+
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
2627
runs-on: ubuntu-latest
2728

2829
permissions:

0 commit comments

Comments
 (0)