Skip to content

Commit 3489fd6

Browse files
authored
feat: added configuration files for dependabot and labeler (#21)
1 parent 48e0aa8 commit 3489fd6

File tree

8 files changed

+142
-0
lines changed

8 files changed

+142
-0
lines changed

.github/dependabot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
pull-request-branch-name:
9+
separator: "-"
10+
11+
# Daily: Check minor and patch updates
12+
- package-ecosystem: "npm"
13+
directory: "/"
14+
schedule:
15+
interval: "daily"
16+
pull-request-branch-name:
17+
separator: "-"
18+
# https://github.com/dependabot/dependabot-core/issues/5226#issuecomment-1179434437
19+
versioning-strategy: increase

.github/labeler.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
# Add 'cicd' label to any file changes inside .github dir
3+
cicd:
4+
- .github/*
5+
- .github/**/*
6+
7+
# Add 'patterns' label to any file changes for the patterns
8+
patterns:
9+
- source/_patterns/**
10+
11+
# Add 'documentation' label to any file changes for the documentation files
12+
documentation:
13+
- ./**/*.md
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Dependabot auto-merge
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
dependabot:
8+
runs-on: ubuntu-latest
9+
if: ${{ github.actor == 'dependabot[bot]' }}
10+
steps:
11+
- name: ⬇ Dependabot metadata
12+
id: metadata
13+
uses: dependabot/fetch-metadata@v1.3.3
14+
with:
15+
github-token: "${{ secrets.GITHUB_TOKEN }}"
16+
17+
- name: ✔ Approve a PR
18+
run: gh pr review --approve "$PR_URL"
19+
env:
20+
PR_URL: ${{github.event.pull_request.html_url}}
21+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
22+
23+
- name: 🤖 Enable auto-merge for Dependabot PRs
24+
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
25+
run: gh pr merge --auto --merge "$PR_URL"
26+
env:
27+
PR_URL: ${{github.event.pull_request.html_url}}
28+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: "CodeQL"
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
analyze:
8+
name: Analyze
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
language: ["javascript"]
14+
15+
steps:
16+
- name: ⬇ Checkout repo
17+
uses: actions/checkout@v3
18+
19+
- name: 🔄 Initialize CodeQL
20+
uses: github/codeql-action/init@v2
21+
with:
22+
languages: ${{ matrix.language }}
23+
24+
- name: 🔨 Autobuild
25+
uses: github/codeql-action/autobuild@v2
26+
27+
- name: 🔎 Perform CodeQL Analysis
28+
uses: github/codeql-action/analyze@v2
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: "Dependency Review"
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
dependency-review:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: ⬇ Checkout repo
11+
uses: actions/checkout@v3
12+
- name: 🔎 Dependency Review
13+
uses: actions/dependency-review-action@v2

.github/workflows/99-labeler.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: "Pull Request Labeler"
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
triage:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: 🏷️ Labeler
11+
uses: actions/labeler@v4
12+
with:
13+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
14+
sync-labels: true

.github/workflows/default.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ jobs:
2121
deploy:
2222
if: contains( github.ref, 'main')
2323
uses: ./.github/workflows/02-deploy-gh-pages.yml
24+
# TODO: we need the following after we've added the preview branch deployments
25+
# if: ${{ github.actor != 'dependabot[bot]' }}
2426
needs: [lint, test, build]

.github/workflows/pull-request.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Default On-Pull-Request
3+
4+
on:
5+
pull_request:
6+
branches: ["main"]
7+
8+
permissions:
9+
pull-requests: write
10+
contents: write
11+
actions: read
12+
security-events: write
13+
14+
jobs:
15+
auto-merge:
16+
uses: ./.github/workflows/99-auto-merge.yml
17+
18+
codeql:
19+
uses: ./.github/workflows/99-codeql-analysis.yml
20+
21+
dependency-review:
22+
uses: ./.github/workflows/99-dependency-review.yml
23+
24+
labeler:
25+
uses: ./.github/workflows/99-labeler.yml

0 commit comments

Comments
 (0)