Fixes for utils scripts #30
Workflow file for this run
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- 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 | |
- name: Install shfmt | |
run: | | |
curl -L "$(curl -s https://api.github.com/repos/mvdan/sh/releases/latest | grep -o -E -m 1 "https://.+?linux_amd64")" > shfmt \ | |
&& chmod +x shfmt && sudo mv shfmt /usr/bin/ | |
- name: Install shellcheck | |
run: | | |
sudo apt update && sudo apt install shellcheck | |
# Need to success pre-commit fix push | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | |
with: | |
python-version: '3.9' | |
- name: Execute pre-commit | |
uses: pre-commit/action@9b88afc9cd57fd75b655d5c71bd38146d07135fe # v2.0.3 | |
env: | |
SKIP: no-commit-to-branch | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
extra_args: --color=always --show-diff-on-failure --files ${{ steps.file_changes.outputs.files }} |