Skip to content

Commit a8c00ec

Browse files
ci: dependabot automerge (#268)
1 parent 2afc220 commit a8c00ec

File tree

3 files changed

+88
-7
lines changed

3 files changed

+88
-7
lines changed

.github/dependabot.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 20
8+
labels:
9+
- dependencies
10+
versioning-strategy: widen
11+
groups:
12+
dependencies:
13+
patterns:
14+
- "*"
15+
update-types:
16+
- "minor"
17+
- "patch"
18+
- package-ecosystem: "github-actions"
19+
directory: "/"
20+
schedule:
21+
interval: "weekly"
22+
open-pull-requests-limit: 20
23+
labels:
24+
- dependencies
25+
groups:
26+
dependencies:
27+
patterns:
28+
- "*"

.github/workflows/dependabot.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Dependabot
2+
3+
on: pull_request
4+
5+
permissions:
6+
contents: write
7+
pull-requests: write
8+
9+
jobs:
10+
dependabot-auto-merge:
11+
runs-on: ubuntu-latest
12+
if: github.actor == 'dependabot[bot]'
13+
steps:
14+
- name: Generate Token
15+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
16+
id: app-token
17+
with:
18+
app-id: ${{ secrets.BOT_APP_ID }}
19+
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
20+
21+
- name: Dependabot metadata
22+
id: dependabot-metadata
23+
uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a # v2.5.0
24+
with:
25+
github-token: "${{ steps.app-token.outputs.token }}"
26+
27+
- name: Enable auto-merge for Dependabot PRs
28+
if: steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major'
29+
run: |
30+
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ];
31+
then gh pr review --approve "$PR_URL"
32+
else echo "PR already approved, skipping additional approvals to minimize emails/notification noise.";
33+
fi
34+
35+
gh pr merge --auto --squash "$PR_URL"
36+
env:
37+
PR_URL: ${{ github.event.pull_request.html_url }}
38+
GH_TOKEN: ${{ steps.app-token.outputs.token }}

.github/workflows/test.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,27 @@ jobs:
1212
lint:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
16+
with:
17+
fetch-depth: 0
18+
1619
- name: Use Node.js
17-
uses: actions/setup-node@v4
20+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
1821
with:
1922
node-version: lts/*
2023
cache: "npm"
24+
2125
- run: npm ci
26+
2227
- name: Cache eslint result
23-
uses: actions/cache@v4
28+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
2429
with:
2530
path: .eslintcache
2631
key: lint-eslint-${{ runner.os }}-node-${{ hashFiles('**/package-lock.json', '**/eslint.config.mjs') }}
2732
restore-keys: lint-eslint-
33+
2834
- run: npm run lint
35+
2936
test:
3037
strategy:
3138
fail-fast: true
@@ -54,8 +61,11 @@ jobs:
5461
polling: "200"
5562
runs-on: ${{ matrix.os }}
5663
steps:
57-
- uses: actions/checkout@v4
58-
- uses: actions/github-script@v7
64+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
65+
with:
66+
fetch-depth: 0
67+
68+
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
5969
id: calculate_architecture
6070
with:
6171
result-encoding: string
@@ -65,20 +75,25 @@ jobs:
6575
} else {
6676
return ''
6777
}
78+
6879
- name: Use Node.js ${{ matrix.node-version }}
69-
uses: actions/setup-node@v4
80+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
7081
with:
7182
node-version: ${{ matrix.node-version }}
7283
architecture: ${{ steps.calculate_architecture.outputs.result }}
7384
cache: "npm"
85+
7486
- run: npm install --ignore-engines
7587
if: matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x'
88+
7689
- run: npm ci
7790
if: matrix.node-version != '10.x' && matrix.node-version != '12.x' && matrix.node-version != '14.x'
91+
7892
- run: npm run test:coverage
7993
env:
8094
WATCHPACK_POLLING: ${{ matrix.polling }}
81-
- uses: codecov/codecov-action@v5
95+
96+
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
8297
with:
8398
flags: integration
8499
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)