Skip to content

Commit 7994069

Browse files
committed
Add the GitHub Actions Workflow
1 parent 68a0b39 commit 7994069

File tree

6 files changed

+196
-0
lines changed

6 files changed

+196
-0
lines changed

.github/dependabot-auto-merge.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- match:
2+
dependency_type: "all"
3+
update_type: "all"

.github/dependabot.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: daily
7+
timezone: Asia/Tokyo
8+
allow:
9+
- dependency-type: all
10+
rebase-strategy: auto
11+
assignees:
12+
- poad
13+
14+
- package-ecosystem: npm
15+
directory: '/'
16+
schedule:
17+
interval: daily
18+
timezone: Asia/Tokyo
19+
allow:
20+
- dependency-type: all
21+
rebase-strategy: auto
22+
assignees:
23+
- poad
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "CodeQL for dependabot"
2+
3+
on:
4+
pull_request_target:
5+
6+
jobs:
7+
analyze:
8+
if: github.actor == 'dependabot[bot]'
9+
10+
name: Analyze
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
language: ['javascript']
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 2
23+
24+
- run: git checkout HEAD^2
25+
if: ${{ github.event_name == 'pull_request' }}
26+
27+
- name: Initialize CodeQL
28+
uses: github/codeql-action/init@v2
29+
with:
30+
languages: ${{ matrix.language }}
31+
- name: Autobuild
32+
uses: github/codeql-action/autobuild@v2
33+
34+
- name: Perform CodeQL Analysis
35+
uses: github/codeql-action/analyze@v2
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
- cron: '41 3 * * 3'
10+
11+
jobs:
12+
analyze:
13+
if: github.actor != 'dependabot[bot]'
14+
name: Analyze
15+
runs-on: ubuntu-latest
16+
permissions:
17+
actions: read
18+
contents: read
19+
security-events: write
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
language: [ 'javascript' ]
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v3
29+
30+
- name: Initialize CodeQL
31+
uses: github/codeql-action/init@v2
32+
with:
33+
languages: ${{ matrix.language }}
34+
35+
- name: Autobuild
36+
uses: github/codeql-action/autobuild@v2
37+
38+
- name: Perform CodeQL Analysis
39+
uses: github/codeql-action/analyze@v2
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: dependabot-auto-merge
2+
3+
on:
4+
pull_request_target:
5+
6+
permissions:
7+
actions: write
8+
checks: write
9+
contents: write
10+
deployments: none
11+
id-token: write
12+
issues: none
13+
packages: none
14+
pull-requests: write
15+
repository-projects: write
16+
security-events: write
17+
statuses: write
18+
19+
jobs:
20+
auto-merge:
21+
runs-on: ubuntu-latest
22+
23+
if: github.actor == 'dependabot[bot]'
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
28+
- uses: ahmadnassri/action-dependabot-auto-merge@v2
29+
with:
30+
github-token: ${{ secrets.PERSONAL_TOKEN_FOR_GITHUB_ACTIONS }}
31+
config: .github/dependabot-auto-merge.yml
32+
33+
- name: Slack Notification (not success)
34+
uses: lazy-actions/slatify@master
35+
if: "! success()"
36+
continue-on-error: true
37+
with:
38+
job_name: '*auto-merge*'
39+
type: ${{ job.status }}
40+
icon_emoji: ":octocat:"
41+
url: ${{ secrets.SLACK_WEBHOOK }}
42+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build and Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
workflow_dispatch:
12+
13+
jobs:
14+
test:
15+
strategy:
16+
matrix:
17+
node-version: [14.x, 16.x]
18+
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v3.4.1
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
check-latest: true
28+
cache: yarn
29+
30+
- uses: actions/cache@v3
31+
with:
32+
path: ~/.npm
33+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
34+
restore-keys: |
35+
${{ runner.os }}-node-
36+
37+
- name: Build
38+
run: yarn install && yarn lint && yarn build
39+
40+
configure:
41+
runs-on: ubuntu-latest
42+
43+
if: github.actor != 'dependabot[bot]'
44+
45+
steps:
46+
- name: Pull request auto merge enabler
47+
if: github.event_name == 'pull_request'
48+
uses: poad/github-pull-request-auto-merge-enable-action@v1.0.2
49+
with:
50+
pull_request_id: ${{ github.event.pull_request.node_id }}
51+
github_token: ${{ secrets.PERSONAL_TOKEN_FOR_GITHUB_ACTIONS }}
52+
repository: ${{ github.event.repository.name }}
53+
owner: ${{ github.repository_owner }}
54+
merge_method: SQUASH

0 commit comments

Comments
 (0)