goldendict-ng/.github/workflows/auto format.yml
2023-07-19 21:13:40 +08:00

61 lines
1.8 KiB
YAML

name: autofix.ci
on:
pull_request:
branches:
# - dev
# - master
- staged
paths-ignore:
- "docs/**"
# - ".github/**"
- "howto/**"
- "*.md"
- "locale/**"
permissions:
contents: read
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.5.2
with:
# check out HEAD on the branch
# ref: ${{ github.head_ref }}
# repository: ${{github.event.pull_request.head.repo.full_name}}
# make sure the parent commit is grabbed as well, because
# that's what will get formatted (i.e. the most recent commit)
fetch-depth: 2
# format the latest commit
- name: ubuntu install clang-format
# if: ${{ github.event.pull_request.head.repo.full_name == 'xiaoyifang/goldendict-ng' }}
id: clang-format
run: |
sudo apt-get install git lsb-release wget software-properties-common
wget -qO - https://apt.llvm.org/llvm.sh| sudo bash
sudo apt-get update
sudo apt-get install -y clang-format
git-clang-format --style=file HEAD^
- uses: autofix-ci/action@89762f9c25dd85f6b78cd40e521232e403357ec0
css-js-html-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci
- run: npx prettier --write src/stylesheets src/scripts/gd-*.js
# Optimize all PNGs with https://pngquant.org/
# - run: sudo apt-get update && sudo apt-get install -y pngquant
# - name: Run pngquant
# run: |
# shopt -s globstar
# pngquant -f --ext .png --skip-if-larger -- **/*.png
- uses: autofix-ci/action@89762f9c25dd85f6b78cd40e521232e403357ec0