switch base branch #70
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
name: Code Quality | |
permissions: | |
pull-requests: write | |
contents: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: 'pages' | |
cancel-in-progress: false | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
code-quality: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install dependencies with pnpm | |
run: pnpm install | |
- name: Run Commitlint | |
run: git log -1 --pretty=%B | pnpm exec commitlint | |
- name: Run ESLint | |
run: pnpm eslint . --max-warnings=0 # Use pnpm | |
- name: Run Prettier | |
run: pnpm prettier --check . # Use pnpm | |
- name: Delete existing semantic-release PR branches | |
run: | | |
git fetch --prune | |
BRANCHES=$(git branch -r | grep 'semantic-release-pr-' || true) | |
if [ -n "$BRANCHES" ]; then | |
echo "$BRANCHES" | sed 's/origin\///' | xargs -r git push origin --delete {} | |
else | |
echo "No semantic-release PR branches found." | |
fi | |
shell: bash | |
- name: Run Semantic Release | |
if: github.ref == 'refs/heads/main' | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: npx semantic-release |