forked from OpenMS/OpenMS
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (47 loc) · 1.44 KB
/
openms_clang_format_add_and_commit.yml
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
# Action to allow clang format linting at the files changed in the PR
name: Apply clang-format on comment and commit to PR
on:
issue_comment:
types: [created]
permissions:
checks: write
contents: write
jobs:
lint:
name: Automatic clang format linting
runs-on: ubuntu-latest
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/reformat')
steps:
# Checkout source code
- name: Checkout
uses: actions/checkout@v3
- name: Checkout Pull Request
run: |
git config --global hub.protocol https
hub pr checkout ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Get files changed in the PR
- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]
with:
path: .
files: |
**/*.h
**/*.cpp
# Perform linting
- name: Use clang format linting
uses: DoozyX/[email protected]
with:
source: ${{ steps.changed-files.outputs.all_changed_files }}
clangFormatVersion: 13
inplace: True
- name: commit
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Linter"
git commit -am "fix lint"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}