-
Notifications
You must be signed in to change notification settings - Fork 66
54 lines (48 loc) · 1.79 KB
/
pr-format.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
53
54
name: FormatPullRequest
on: issue_comment
jobs:
format:
name: Format the pull request if the '~format' comment is made
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '~format') }}
runs-on: ubuntu-22.04
steps:
- uses: octokit/[email protected]
id: get_branch
with:
query: |
query get_branch($owner:String!,$repo:String!,$pr_num:Int!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $pr_num) {
headRefName
}
}
}
owner: ${{ github.event.repository.owner.login }}
repo: ${{ github.event.repository.name }}
pr_num: ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v4
with:
path: iotivity-lite
ref: ${{ fromJSON(steps.get_branch.outputs.data).repository.pullRequest.headRefName }}
- name: add reaction
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ github.event.comment.id }}
reactions: eyes
- name: build-docs
run: |
sudo apt-get update -y
sudo apt-get install clang-format-14
cmake -S ${{ github.workspace }}/iotivity-lite -B ${{ github.workspace }}/build-format
make -C ${{ github.workspace }}/build-format format
- name: push-changes
run: |
cd ${{ github.workspace }}/iotivity-lite
git config --global user.name 'Cascoda Bot'
git config --global user.email '[email protected]'
git add .
git diff-index --quiet HEAD || git commit -m "Automatic format commit"
git push