mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 08:34:08 +00:00
45 lines
1.3 KiB
YAML
45 lines
1.3 KiB
YAML
name: "auto clang-format code"
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
# - dev
|
|
# - master
|
|
- staged
|
|
paths-ignore:
|
|
- "docs/**"
|
|
# - ".github/**"
|
|
- "howto/**"
|
|
- "*.md"
|
|
- "locale/**"
|
|
|
|
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
|