chore(deps): update actions/checkout action to v4.2.1 #218
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Common issues check | |
on: [pull_request] | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | |
- run: | | |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* | |
- name: Get changed files | |
id: file_changes | |
run: | | |
export DIFF=$(git diff --name-only origin/${{ github.base_ref }} ${{ github.sha }}) | |
echo "Diff between ${{ github.base_ref }} and ${{ github.sha }}" | |
echo "files=$( echo "$DIFF" | xargs echo )" >> $GITHUB_OUTPUT | |
- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 | |
with: | |
python-version: '3.9' | |
# Need to success pre-commit fix push | |
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
# Need to trigger pre-commit workflow on autofix commit | |
# Guide: https://web.archive.org/web/20210731173012/https://github.community/t/required-check-is-expected-after-automated-push/187545/ | |
ssh-key: "${{ secrets.GHA_AUTOFIX_COMMIT_KEY }}" | |
- name: Execute pre-commit | |
uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # v3.0.0 | |
env: | |
SKIP: no-commit-to-branch | |
with: | |
extra_args: --color=always --show-diff-on-failure --files ${{ steps.file_changes.outputs.files }} | |
# Need to trigger pre-commit workflow on autofix commit. | |
# Native pre-commit action fix by `token` not works in this case. | |
- name: Push fixes | |
if: failure() | |
uses: EndBug/add-and-commit@1bad3abcf0d6ec49a5857d124b0bfb52dc7bb081 # v9.1.3 | |
with: | |
# Determines the way the action fills missing author name and email. Three options are available: | |
# - github_actor -> UserName <[email protected]> | |
# - user_info -> Your Display Name <[email protected]> | |
# - github_actions -> github-actions <email associated with the github logo> | |
# Default: github_actor | |
default_author: github_actor | |
# The message for the commit. | |
# Default: 'Commit from GitHub Actions (name of the workflow)' | |
message: '[pre-commit] Autofix violations' |