Skip to content

Commit 5b701df

Browse files
axemclionclaude
andcommitted
Add CI workflow and Dependabot automation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8fc5c01 commit 5b701df

5 files changed

Lines changed: 68 additions & 1 deletion

File tree

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
target-branch: "master"
8+
groups:
9+
dev-dependencies:
10+
patterns:
11+
- "*"
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
schedule:
15+
interval: "weekly"
16+
target-branch: "master"

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
branches: [master]
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: '18'
15+
cache: 'npm'
16+
- run: npm install
17+
- run: npm test
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Dependabot auto-merge
2+
on: pull_request
3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
jobs:
7+
auto-merge:
8+
runs-on: ubuntu-latest
9+
if: github.actor == 'dependabot[bot]'
10+
steps:
11+
- name: Fetch Dependabot metadata
12+
id: metadata
13+
uses: dependabot/fetch-metadata@v2
14+
with:
15+
github-token: "${{ secrets.GITHUB_TOKEN }}"
16+
- name: Enable auto-merge
17+
run: gh pr merge --auto --squash "$PR_URL"
18+
env:
19+
PR_URL: ${{ github.event.pull_request.html_url }}
20+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Dependabot gate
2+
on: pull_request
3+
jobs:
4+
dependabot-only:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Block non-Dependabot PRs
8+
run: |
9+
if [ "${{ github.actor }}" != "dependabot[bot]" ]; then
10+
echo "This repository only accepts PRs from Dependabot."
11+
exit 1
12+
fi
13+
echo "PR is from Dependabot, allowed."

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"scripts": {
77
"build-demo": "webpack --config test/webpack.config.js",
88
"demo": "webpack-dev-server --config test/webpack.config.js",
9-
"perf": "node test/perf.js"
9+
"perf": "node test/perf.js",
10+
"test": "npm run build-demo"
1011
},
1112
"author": "Parashuram <code@nparashuram.com>",
1213
"license": "BSD-3-Clause",

0 commit comments

Comments
 (0)