Skip to content

Zeebe-rest

Zeebe-rest #258

Workflow file for this run

name: Commitlint
on: [pull_request]
jobs:
lint-commits:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensures commit history is fetched
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "18" # Specify a Node.js version
- name: Install dependencies
run: npm install
- name: Lint last commit message
run: npx commitlint --from=${{ github.event.pull_request.base.sha }} --to=${{ github.event.pull_request.head.sha }} --verbose
- name: Run Prettier
run: npm run format
- name: Run ESLint
run: npm run lint
- name: Commit and push if changes
run: |
git config --global user.name 'GitHub Action'
git config --global user.email 'josh.wulf@camunda.com'
# Check out the branch
git fetch
git checkout ${{ github.head_ref }}
# Add, commit, and push changes, ignoring package-lock.json
git diff --name-only | xargs git add
git diff --staged --quiet || git commit -m "Apply Prettier formatting"
git push origin ${{ github.head_ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}