-
Notifications
You must be signed in to change notification settings - Fork 20
70 lines (66 loc) · 2.22 KB
/
Copy pathformatapply.yml
File metadata and controls
70 lines (66 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Apply code format
on:
workflow_dispatch:
jobs:
format:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v6
# First format Python
- uses: psf/black@stable
with:
options: ""
src: "."
jupyter: true
- name: Commit Formatting for Python
run: |
git config user.name 'Auto Format'
git config user.email 'dev@stormchecker.org'
if [ -z "$(git status --porcelain)" ]
then
echo "Code did not change"
else
git commit -am "Applied code formatting for Python"
git rev-parse HEAD >> .git-blame-ignore-revs
git commit -am "Add code formatting commit to .git-blame-ignore-revs"
fi
# Second format C++
# apply the formatting twice as a workaround for a clang-format bug
- uses: DoozyX/clang-format-lint-action@v0.20
with:
source: './src'
clangFormatVersion: 20
style: file
inplace: True
- uses: DoozyX/clang-format-lint-action@v0.20
with:
source: './src'
clangFormatVersion: 20
style: file
inplace: True
- name: Commit Formatting for C++
run: |
git config user.name 'Auto Format'
git config user.email 'dev@stormchecker.org'
if [ -z "$(git status --porcelain)" ]
then
echo "Code did not change"
else
git commit -am "Applied code formatting for C++"
git rev-parse HEAD >> .git-blame-ignore-revs
git commit -am "Add code formatting commit to .git-blame-ignore-revs"
fi
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v8
with:
branch: ci/apply-code-format
delete-branch: true
title: 'Code formatting'
body: |
Auto-generated pull request triggered by the `apply-code-format` workflow.
- Manually close and reopen this PR to trigger the CI.
- Make sure to **merge** (and not rebase) this PR so that the added commit hash in `.git-blame-ignore-revs` remains valid.