Skip to content

Commit 8a3ed90

Browse files
committed
clean
1 parent 1b8304c commit 8a3ed90

1 file changed

Lines changed: 7 additions & 28 deletions

File tree

templates/.github/workflows/ci.yaml

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
steps:
1212
- name: Checkout code
1313
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
1416

1517
- name: Set up Python
1618
uses: actions/setup-python@v4
@@ -29,9 +31,8 @@ jobs:
2931
uses: actions/cache@v3
3032
with:
3133
path: /usr/local/bin/shfmt
32-
key: ${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
34+
key: ${{ runner.os }}-shfmt-
3335
restore-keys: |
34-
${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
3536
${{ runner.os }}-shfmt-
3637
3738
- name: Cache Pre-Commit environments
@@ -43,40 +44,18 @@ jobs:
4344
${{ runner.os }}-pc-${{ hashFiles('.pre-commit-config.yaml') }}
4445
${{ runner.os }}-pc-
4546
46-
# - name: Install dependencies
47-
# run: |
48-
# python -m pip install pre-commit
49-
# pre-commit install
50-
5147
- name: Install dependencies
5248
run: |
5349
make setuppc
5450
55-
# SHFMT_VERSION=${{ env.SHFMT_VERSION }}
56-
# SHFMT_BIN="shfmt_${SHFMT_VERSION}_linux_amd64"
57-
# if [[ ! -f /usr/local/bin/shfmt ]]; then
58-
# wget -O shfmt "https://github.com/mvdan/sh/releases/download/${SHFMT_VERSION}/${SHFMT_BIN}"
59-
# chmod +x shfmt
60-
# sudo mv shfmt /usr/local/bin/
61-
# fi
62-
# sudo apt-get install shellcheck
6351
- name: Run pre-commits
6452
env:
6553
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6654
run: |
67-
REPO_NAME=$(echo $GITHUB_REPOSITORY | sed 's/^.*\///')
68-
DEFAULT_BRANCH=$(curl -H "Authorization: token $GITHUB_TOKEN" \
69-
"https://api.github.com/repos/$GITHUB_REPOSITORY" | jq -r '.default_branch')
70-
71-
git fetch
72-
CUR_SHA=$(git log --pretty=tformat:"%H" -n1 . | tail -n1)
55+
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
7356
74-
echo "Default branch is $DEFAULT_BRANCH"
75-
echo "Current SHA is $CUR_SHA"
57+
echo "Default branch = $DEFAULT_BRANCH"
58+
echo "Current SHA = ${{ github. sha }}"
7659
77-
if [[ $GITHUB_REF == "refs/heads/$DEFAULT_BRANCH" ]]; then
78-
pre-commit run --all
79-
else
80-
pre-commit run --from-ref origin/$DEFAULT_BRANCH --to-ref $CUR_SHA
81-
fi
60+
pre-commit run --from-ref origin/$DEFAULT_BRANCH --to-ref "${{ github. sha }}"
8261
{%- endraw %}

0 commit comments

Comments
 (0)