push lint output to branch

This commit is contained in:
hobbes7878 2024-08-21 17:21:25 +01:00
parent aa47481f1e
commit 9bb9996dd9

View file

@ -30,11 +30,30 @@ jobs:
- id: install-deps - id: install-deps
name: Install dependencies name: Install dependencies
run: npm ci run: npm ci
- id: lint
name: Lint code
run: npm run lint
- id: run-linters - id: format
name: Run linters name: Format code
uses: wearerequired/lint-action@v2 run: npm run format
with:
auto_fix: true - id: get_branch_name
eslint: true name: Get branch name
prettier: true run: echo "branch_name=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
- id: checkout_branch
name: Checkout to branch
run: git checkout ${{ env.branch_name }}
- id: commit_and_push
name: Commit and push formatted code
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit --allow-empty -m "lint and format"
git push origin HEAD:${{ env.branch_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}