Skip to content

Commit a254790

Browse files
committed
ci: add dependabot with auto-merge and require E2E tests on PRs - stan
1 parent a58e19d commit a254790

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 10
8+
groups:
9+
dev-dependencies:
10+
dependency-type: "development"
11+
production-dependencies:
12+
dependency-type: "production"
13+
14+
- package-ecosystem: "github-actions"
15+
directory: "/"
16+
schedule:
17+
interval: "weekly"
18+
open-pull-requests-limit: 5
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Dependabot Auto-Merge
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
10+
jobs:
11+
automerge:
12+
runs-on: ubuntu-latest
13+
if: github.actor == 'dependabot[bot]'
14+
15+
steps:
16+
- name: Fetch Dependabot metadata
17+
id: metadata
18+
uses: dependabot/fetch-metadata@v2
19+
with:
20+
github-token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Auto-approve Dependabot PR
23+
run: gh pr review --approve "$PR_URL"
24+
env:
25+
PR_URL: ${{ github.event.pull_request.html_url }}
26+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Enable auto-merge for Dependabot PR
29+
run: gh pr merge --auto --squash "$PR_URL"
30+
env:
31+
PR_URL: ${{ github.event.pull_request.html_url }}
32+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/e2e-tests.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
name: E2E Tests
22

33
on:
4-
# Runs after unit tests complete successfully
4+
# Runs on PRs so we can gate merges on E2E results
5+
pull_request:
6+
branches: ["main", "master"]
7+
# Runs after unit tests complete successfully on push
58
workflow_run:
69
workflows: ["Run Tests"]
710
types:
@@ -11,7 +14,7 @@ on:
1114
jobs:
1215
e2e-tests:
1316
runs-on: ubuntu-latest
14-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
17+
if: ${{ github.event_name == 'pull_request' || github.event.workflow_run.conclusion == 'success' }}
1518

1619
steps:
1720
- name: Checkout code

0 commit comments

Comments
 (0)