From 1ff4464db998fa5be054d981b950a28fdc797cfe Mon Sep 17 00:00:00 2001 From: Raman Aktsisiuk Date: Mon, 2 Sep 2024 20:29:08 +0200 Subject: [PATCH] ci: add comment if can't be auto fixed --- .github/workflows/lint.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 12d58af1..84fd2098 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -32,6 +32,7 @@ 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" @@ -39,3 +40,14 @@ jobs: 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." + })