Skip to content

Commit 3c64741

Browse files
Add Comment triggered uncrustify script (#400)
* Add automated uncrustify * Un-uncrustify * Uncrustify - manually * Remove unused comment * Update user to be github action * Remove catch_assert from uncrustify
1 parent e176f32 commit 3c64741

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/uncrustify.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Uncrustify the source code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
jobs:
8+
Uncrustify:
9+
name: Run_Uncrustify
10+
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/bot run uncrustify' }}
11+
runs-on: ubuntu-18.04
12+
steps:
13+
- name: Dump GitHub context
14+
env:
15+
GITHUB_CONTEXT: ${{ toJson(github) }}
16+
run: echo "$GITHUB_CONTEXT"
17+
- name: get pullrequest url
18+
run: |
19+
echo ${{ github.event.issue.pull_request.url }}
20+
- name: get upstream repo
21+
id: upstreamrepo
22+
run: |
23+
echo "::set-output name=RemoteRepo::$(curl -H "Accept: application/vnd.github.sailor-v-preview+json" --url ${{ github.event.issue.pull_request.url }} | jq '.head.repo.full_name' | sed 's/\"//g')"
24+
- name: get upstream branch
25+
id: upstreambranch
26+
run: |
27+
echo "::set-output name=branchname::$(curl -H "Accept: application/vnd.github.sailor-v-preview+json" --url ${{ github.event.issue.pull_request.url }} | jq '.head.ref' | sed 's/\"//g')"
28+
- name: echo upstream repo:branch
29+
run: |
30+
echo ${{ steps.upstreamrepo.outputs.RemoteRepo }}:${{ steps.upstreambranch.outputs.branchname }}
31+
- name: Checkout upstream repo
32+
uses: actions/checkout@v2
33+
with:
34+
token: ${{ secrets.PAT }}
35+
repository: ${{ steps.upstreamrepo.outputs.RemoteRepo }}
36+
ref: ${{ steps.upstreambranch.outputs.branchname }}
37+
- name: Install Uncrustify
38+
run: sudo apt-get install uncrustify
39+
- name: Run Uncrustify
40+
run: |
41+
uncrustify --version
42+
find . -not -path '.*catch_assert.h' -iname "*.[hc]" -exec uncrustify -c tools/uncrustify.cfg --no-backup --replace {} +
43+
- name: Push changes to upstream repository
44+
run: |
45+
git config --global user.name 'GitHub Action'
46+
git config --global user.email '[email protected]'
47+
git add -A
48+
git commit -m "Uncrustify: triggered by comment."
49+
git push

0 commit comments

Comments
 (0)