Skip to content

Commit

Permalink
feat(ci): add PR evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeAeich committed Mar 5, 2024
1 parent 6b03757 commit aac7380
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 8 deletions.
112 changes: 112 additions & 0 deletions .github/workflows/pr_evaluation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: PR Evaluation
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
- edited
branches:
- main
jobs:
semantic_pr:
name: Semantic PR title
runs-on: ubuntu-latest
if: ${{ github.event.action != 'edited' || github.event.changes.title != null }}
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
fix
feat
docs
style
refactor
perf
test
build
ci
chore
revert
subjectPattern: ^(?![A-Z])(?=.{1,50}$).+$
subjectPatternError: >
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character & not have more than 50 characters.
detect-unresolved-conflicts:
name: Detect unresolved merge conflicts
runs-on: ubuntu-latest
needs: semantic_pr
steps:
- uses: actions/checkout@v4
- name: List files with merge conflict markers
run: git --no-pager grep "<<<<<<<" ":(exclude).github/" || true
- name: Fail or succeed job if any files with merge conflict markers have been
checked in
run: exit $(git grep "<<<<<<<" ":(exclude).github/" | wc --lines)
linters:
name: Linting checks
runs-on: ubuntu-latest
needs: semantic_pr
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Get node version
id: node
run: |
echo "::set-output name=version::$(node -v)"
- name: Get node_modules cache
uses: actions/[email protected]
id: node_modules
with:
path: |
**/node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package.lock') }}-${{
steps.node.outputs.version }}
- name: Install dependencies
run: npm install
- name: Run linters
run: npm run lint
formatter:
name: Check code format
runs-on: ubuntu-latest
needs: semantic_pr
strategy:
matrix:
node-version: 20.x
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Get node version
id: node
run: |
echo "::set-output name=version::$(node -v)"
- name: Get node_modules cache
uses: actions/[email protected]
id: node_modules
with:
path: |
**/node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package.lock') }}-${{
steps.node.outputs.version }}
- name: Install dependencies
run: npm install
- name: Run tests
run: npm run format:check
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"lint": "next lint",
"lint-fix": "eslint ./ --fix",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"format:check": "prettier --check \"**/*.{js,jsx,json,md}\"",
"prepare": "husky install",
"pre-commit": "lint-staged"
},
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,15 @@
dependencies:
glob "7.1.7"

"@next/swc-darwin[email protected]":
"@next/swc-linux-x64-gnu@13.4.19":
version "13.4.19"
resolved "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.19.tgz"
integrity sha512-jyzO6wwYhx6F+7gD8ddZfuqO4TtpJdw3wyOduR4fxTUCm3aLw7YmHGYNjS0xRSYGAkLpBkH1E0RcelyId6lNsw==
resolved "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.19.tgz"
integrity sha512-htwOEagMa/CXNykFFeAHHvMJeqZfNQEoQvHfsA4wgg5QqGNqD5soeCer4oGlCol6NGUxknrQO6VEustcv+Md+g==

"@next/[email protected]":
version "13.4.19"
resolved "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.19.tgz"
integrity sha512-4Gj4vvtbK1JH8ApWTT214b3GwUh9EKKQjY41hH/t+u55Knxi/0wesMzwQRhppK6Ddalhu0TEttbiJ+wRcoEj5Q==

"@nodelib/[email protected]":
version "2.1.5"
Expand Down Expand Up @@ -1486,11 +1491,6 @@ fs.realpath@^1.0.0:
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==

fsevents@~2.3.2:
version "2.3.3"
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz"
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==

function-bind@^1.1.1:
version "1.1.1"
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"
Expand Down

0 comments on commit aac7380

Please sign in to comment.