-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac31d67
commit b6463e9
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Validate | ||
on: | ||
pull_request: | ||
types: [ opened, reopened, synchronize ] | ||
|
||
permissions: | ||
contents: read # for checkout | ||
|
||
jobs: | ||
lint: | ||
name: Check code format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "lts/*" | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Prepare environment | ||
run: yarn lint:check | ||
commits: | ||
name: Check commits | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "lts/*" | ||
- name: Install dependencies | ||
run: yarn install -g @commitlint/cli @commitlint/config-conventional | ||
- name: Configure | ||
run: | | ||
echo 'module.exports = {"extends": ["@commitlint/config-conventional"]}' > commitlint.config.js | ||
- name: Validate | ||
run: | | ||
git fetch | ||
npx commitlint \ | ||
--from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} \ | ||
--to ${{ github.event.pull_request.head.sha }} \ | ||
--verbose |