Skip to content

Commit

Permalink
ci(github): fix commitlint job on rebased commit or new branch
Browse files Browse the repository at this point in the history
Co-authored-by: Tobi Dimmel <[email protected]>
  • Loading branch information
GagaMen and TobiDimmel committed Aug 30, 2023
1 parent 7b2afa6 commit 79c1505
Showing 1 changed file with 67 additions and 58 deletions.
125 changes: 67 additions & 58 deletions .github/workflows/run-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ jobs:
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
# 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:
needs: setup
Expand All @@ -71,54 +71,63 @@ jobs:
path: workspace
key: workspace-${{ github.sha }}

- name: Run commitlint on push
if: github.event_name == 'push'
working-directory: workspace
run: npx --no -- commitlint --from ${{ github.event.before }} --to HEAD --verbose

- name: Run commitlint on pull request
if: github.event_name == 'pull_request'
working-directory: workspace
run: npx --no -- commitlint --from ${{ github.event.pull_request.base.sha }} --verbose

eslint:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Cache workspace
uses: actions/cache@v3
with:
path: workspace
key: workspace-${{ github.sha }}
- name: Checkout master branch
if: github.ref_name != 'master'
run: git fetch origin master && git checkout master && git pull

- name: Run eslint
- name: Change back to triggered branch
if: github.ref_name != 'master'
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 }}
run: git checkout ${{ github.ref_name }}

- name: Run stylelint
- name: Run commitlint on push to master
if: github.ref_name == 'master'
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 }}
run: npx --no -- commitlint --from ${{ github.event.before }} --verbose

- name: Run markdownlint
- name: Run commitlint on push to branch
if: github.ref_name != 'master'
working-directory: workspace
run: npm run markdownlint
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

0 comments on commit 79c1505

Please sign in to comment.