2023-05-16 12:09:37 +00:00
|
|
|
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:
|
2023-05-20 05:19:23 +00:00
|
|
|
- uses: actions/checkout@v3.5.2
|
2023-05-16 12:09:37 +00:00
|
|
|
with:
|
|
|
|
# check out HEAD on the branch
|
|
|
|
ref: ${{ github.head_ref }}
|
2023-05-27 10:07:36 +00:00
|
|
|
repository: ${{github.event.pull_request.head.repo.full_name}}
|
2023-05-16 12:09:37 +00:00
|
|
|
# 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
|
2023-05-27 15:07:06 +00:00
|
|
|
if: ${{ github.event.pull_request.head.repo.full_name == 'xiaoyifang/goldendict-ng' }}
|
|
|
|
id: clang-format
|
2023-05-16 12:09:37 +00:00
|
|
|
run: |
|
2023-05-16 12:34:28 +00:00
|
|
|
sudo apt-get install git lsb-release wget software-properties-common
|
2023-05-19 11:41:27 +00:00
|
|
|
wget -qO - https://apt.llvm.org/llvm.sh| sudo bash
|
2023-05-16 12:34:28 +00:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y clang-format
|
2023-05-16 12:09:37 +00:00
|
|
|
git-clang-format --style=file HEAD^
|
2023-05-27 15:07:06 +00:00
|
|
|
|
2023-05-21 12:09:54 +00:00
|
|
|
|
|
|
|
- uses: EndBug/add-and-commit@v9
|
2023-05-27 10:07:36 +00:00
|
|
|
if: ${{ github.event.pull_request.head.repo.full_name == 'xiaoyifang/goldendict-ng' }}
|
|
|
|
with:
|
|
|
|
default_author: github_actor
|
|
|
|
message: 🎨 apply clang-format changes
|