goldendict-ng/.github/workflows/auto format.yml
YiFang Xiao bfba6e1f67 action: use autofix.ci to format code
opt: ignore clang-format on style/js files

action: prettier ignore file
2023-07-15 14:04:52 +08:00

69 lines
2.1 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: EndBug/add-and-commit@v9
if: ${{ github.event.pull_request.head.repo.full_name == 'xiaoyifang/goldendict-ng' }}
with:
default_author: github_actor
message: 🎨 apply clang-format changes
- 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