ci(github): fix commitlint job on rebased commit or new branch #158
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: Run checks | |
on: | |
push: | |
branches-ignore: | |
# ignore wiki-bot-update branches, because internal pull requests trigger both the on push and the on pull request event | |
- wiki-bot-update-* | |
pull_request: | |
branches: | |
- master | |
jobs: | |
# setup: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v3 | |
# with: | |
# # we need the whole history to run commitlint correctly if multiple commit are pushed at the same time | |
# fetch-depth: 0 | |
# path: workspace | |
# - name: Setup Node.js | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: 18 | |
# - name: Setup npm | |
# run: npm install -g npm@9 | |
# - name: Cache Node.js modules | |
# uses: actions/cache@v3 | |
# with: | |
# # npm cache files are stored in `~/.npm` on Linux/macOS | |
# path: ~/.npm | |
# key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | |
# restore-keys: | | |
# ${{ runner.OS }}-node- | |
# - name: Install dependencies | |
# working-directory: workspace | |
# run: npm ci | |
# - name: Cache workspace | |
# uses: actions/cache@v3 | |
# with: | |
# path: workspace | |
# key: workspace-${{ github.sha }} | |
# test: | |
# needs: setup | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Cache workspace | |
# uses: actions/cache@v3 | |
# with: | |
# path: workspace | |
# key: workspace-${{ github.sha }} | |
# - name: Run tests | |
# working-directory: workspace | |
# run: npm run test:ci | |
commitlint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
# we need the whole history to run commitlint correctly if multiple commit are pushed at the same time | |
fetch-depth: 0 | |
path: workspace | |
- name: Git Fetch | |
working-directory: workspace | |
run: git fetch origin master | |
- name: Git Branch | |
working-directory: workspace | |
run: git branch | |
- name: Git Log | |
working-directory: workspace | |
run: git log master | |
# - name: Checkout master branch | |
# if: github.ref_name != 'master' | |
# uses: actions/checkout@v3 | |
# with: | |
# ref: master | |
# path: workspace | |
# - name: Change back to triggered branch | |
# if: github.ref_name != 'master' | |
# working-directory: workspace | |
# run: git checkout ${{ github.ref_name }} | |
# - name: Run commitlint on push to master | |
# if: github.ref_name == 'master' | |
# working-directory: workspace | |
# run: npx --no -- commitlint --from ${{ github.event.before }} --verbose | |
# - name: Run commitlint on push to branch | |
# if: github.ref_name != 'master' | |
# working-directory: workspace | |
# run: npx --no -- commitlint --from refs/heads/master --verbose | |
# eslint: | |
# needs: setup | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Cache workspace | |
# uses: actions/cache@v3 | |
# with: | |
# path: workspace | |
# key: workspace-${{ github.sha }} | |
# - name: Run eslint | |
# working-directory: workspace | |
# run: npm run eslint | |
# stylelint: | |
# needs: setup | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Cache workspace | |
# uses: actions/cache@v3 | |
# with: | |
# path: workspace | |
# key: workspace-${{ github.sha }} | |
# - name: Run stylelint | |
# working-directory: workspace | |
# run: npm run stylelint | |
# markdownlint: | |
# needs: setup | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Cache workspace | |
# uses: actions/cache@v3 | |
# with: | |
# path: workspace | |
# key: workspace-${{ github.sha }} | |
# - name: Run markdownlint | |
# working-directory: workspace | |
# run: npm run markdownlint |