Skip to content

add help

add help #60

Workflow file for this run

name: CI
on:
pull_request: # Start the job on all PRs
branches: [master, main]
types: [synchronize, opened, reopened, ready_for_review]
push: # Start the job on all main branch push
branches: [master, main]
jobs:
precommit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-
restore-keys: |
${{ runner.os }}-pip-
- name: Cache shfmt binary
uses: actions/cache@v3
with:
path: /usr/local/bin/shfmt
# key: ${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
key: ${{ runner.os }}-shfmt-
- name: Cache Pre-Commit environments
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
# key: ${{ runner.os }}-pc-${{ hashFiles('.pre-commit-config.yaml') }}
key: ${{ runner.os }}-pc-
restore-keys: |
${{ runner.os }}-pc-
- name: Install dependencies
run: |
python -m pip install pre-commit
pre-commit install
- name: Install shfmt
run: |
SHFMT_VERSION="v3.7.0"
SHFMT_BIN="shfmt_${SHFMT_VERSION}_linux_amd64"
if [[ ! -f /usr/local/bin/shfmt ]]; then
wget -O shfmt "https://github.com/mvdan/sh/releases/download/${SHFMT_VERSION}/${SHFMT_BIN}"
chmod +x shfmt
sudo mv shfmt /usr/local/bin/
fi
sudo apt-get install shellcheck
- name: Run pre-commits
run: |
CUR_SHA=$(git log --pretty=tformat:"%H" -n1 .)
echo $CUR_SHA
echo ${{ env.BASE_COMMIT_ID }}
git fetch
pre-commit run --from-ref origin/main --to-ref $CUR_SHA