Skip to content

Commit

Permalink
ci: add comment if can't be auto fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
romadryud committed Sep 2, 2024
1 parent 956e9e3 commit 1ff4464
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,22 @@ jobs:
if: steps.prettier_check.outputs.PRETTIER_EXIT_CODE == 1
run: npm run prettify
- name: Commit and push changes
continue-on-error: true
if: ${{ success() && steps.prettier_run.conclusion == 'success' }}
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git commit -am "chore: run prettier"
git push origin HEAD:${{ github.event.pull_request.head.ref }}
- name: Post commit if push can not be performed
if: ${{ failure() }}
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "It looks like you forgot to run Prettier, and we can't do it for you automatically. Please run `npm run prettify` and commit the changes."
})

0 comments on commit 1ff4464

Please sign in to comment.