Skip to content

Commit 23d5381

Browse files
authored
Merge pull request #263 from first-contributions-ja/chore/format-yaml-#262
コード自動フォーマットのため、GitHub Actionsの設定を追加
2 parents db24e0a + 9bb7a9f commit 23d5381

File tree

1 file changed

+46
-8
lines changed

1 file changed

+46
-8
lines changed

.github/workflows/nextjs.yml

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@ on:
1111

1212
# Allows you to run this workflow manually from the Actions tab
1313
workflow_dispatch:
14-
15-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16-
permissions:
17-
contents: read
18-
pages: write
19-
id-token: write
20-
14+
2115
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
2216
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2317
concurrency:
@@ -26,8 +20,45 @@ concurrency:
2620

2721
jobs:
2822
# Build job
23+
24+
format:
25+
runs-on: ubuntu-latest
26+
27+
# Sets permissions of the GITHUB_TOKEN to commit and push the changed files back to the repository.
28+
permissions:
29+
contents: write
30+
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
35+
- name: Set up Node.js
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: '20'
39+
ref: ${{ github.head_ref }}
40+
41+
- name: Install dependencies
42+
run: npm install
43+
44+
- name: Run Prettier
45+
run: npm run format
46+
47+
- name: Run Linter
48+
run: npm run lint
49+
50+
- uses: stefanzweifel/git-auto-commit-action@v5
51+
with:
52+
commit_message: "[GitHub Actions] コードをフォーマット"
53+
2954
build:
3055
runs-on: ubuntu-latest
56+
needs: format
57+
58+
# Sets permissions of the GITHUB_TOKEN to read the repository.
59+
permissions:
60+
contents: read
61+
3162
steps:
3263
- name: Checkout
3364
uses: actions/checkout@v4
@@ -87,7 +118,14 @@ jobs:
87118
url: ${{ steps.deployment.outputs.page_url }}
88119
runs-on: ubuntu-latest
89120
needs: build
121+
122+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
123+
permissions:
124+
contents: read
125+
pages: write
126+
id-token: write
127+
90128
steps:
91129
- name: Deploy to GitHub Pages
92130
id: deployment
93-
uses: actions/deploy-pages@v4
131+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)