Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
ysawa0 committed May 12, 2024
1 parent 1b8304c commit 8a3ed90
Showing 1 changed file with 7 additions and 28 deletions.
35 changes: 7 additions & 28 deletions templates/.github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -29,9 +31,8 @@ jobs:
uses: actions/cache@v3
with:
path: /usr/local/bin/shfmt
key: ${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
key: ${{ runner.os }}-shfmt-
restore-keys: |
${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
${{ runner.os }}-shfmt-
- name: Cache Pre-Commit environments
Expand All @@ -43,40 +44,18 @@ jobs:
${{ runner.os }}-pc-${{ hashFiles('.pre-commit-config.yaml') }}
${{ runner.os }}-pc-
# - name: Install dependencies
# run: |
# python -m pip install pre-commit
# pre-commit install

- name: Install dependencies
run: |
make setuppc
# SHFMT_VERSION=${{ env.SHFMT_VERSION }}
# 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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
REPO_NAME=$(echo $GITHUB_REPOSITORY | sed 's/^.*\///')
DEFAULT_BRANCH=$(curl -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_REPOSITORY" | jq -r '.default_branch')
git fetch
CUR_SHA=$(git log --pretty=tformat:"%H" -n1 . | tail -n1)
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
echo "Default branch is $DEFAULT_BRANCH"
echo "Current SHA is $CUR_SHA"
echo "Default branch = $DEFAULT_BRANCH"
echo "Current SHA = ${{ github. sha }}"
if [[ $GITHUB_REF == "refs/heads/$DEFAULT_BRANCH" ]]; then
pre-commit run --all
else
pre-commit run --from-ref origin/$DEFAULT_BRANCH --to-ref $CUR_SHA
fi
pre-commit run --from-ref origin/$DEFAULT_BRANCH --to-ref "${{ github. sha }}"
{%- endraw %}

0 comments on commit 8a3ed90

Please sign in to comment.