-
Notifications
You must be signed in to change notification settings - Fork 208
Add Comment triggered uncrustify script #400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
be9fe45
a342f50
9de49b5
7e84016
3c4db2d
b183908
d384db0
36cc08c
d43a5fc
393669b
9fd9010
59d63eb
7f2ca0a
c5b11bc
491470f
5440582
7c1bfd2
013f781
216552b
5e51570
ad97450
cae9867
2489819
3e3b401
2616a3f
c4a2f70
9936eee
adf8de2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: Uncrustify the source code | ||
|
|
||
| on: | ||
| issue_comment: | ||
| types: [created] | ||
|
|
||
| jobs: | ||
| Uncrustify: | ||
| name: Run_Uncrustify | ||
| if: ${{ github.event.issue.pull_request && github.event.comment.body == '/bot run uncrustify' }} | ||
| runs-on: ubuntu-18.04 | ||
| steps: | ||
| - name: Dump GitHub context | ||
| env: | ||
| GITHUB_CONTEXT: ${{ toJson(github) }} | ||
| run: echo "$GITHUB_CONTEXT" | ||
| - name: get pullrequest url | ||
| run: | | ||
| echo ${{ github.event.issue.pull_request.url }} | ||
| - name: get upstream repo | ||
| id: upstreamrepo | ||
| run: | | ||
| 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')" | ||
| - name: get upstream branch | ||
| id: upstreambranch | ||
| run: | | ||
| 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')" | ||
| - name: echo upstream repo:branch | ||
| run: | | ||
| echo ${{ steps.upstreamrepo.outputs.RemoteRepo }}:${{ steps.upstreambranch.outputs.branchname }} | ||
| - name: Checkout upstream repo | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| token: ${{ secrets.PAT }} | ||
| repository: ${{ steps.upstreamrepo.outputs.RemoteRepo }} | ||
| ref: ${{ steps.upstreambranch.outputs.branchname }} | ||
| - name: Install Uncrustify | ||
| run: sudo apt-get install uncrustify | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cobusve mentioned that there have been compatibility issues between different versions of uncrustify and our config. It might be best to pin this to a particular version.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, as I mentioned above, Ubuntu 18.04 comes with a certain version of uncrustify. And that is what is suitable for us. If that changes, we'd need to update this too. |
||
| - name: Run Uncrustify | ||
| run: | | ||
| uncrustify --version | ||
| find . -not -path '.*catch_assert.h' -iname "*.[hc]" -exec uncrustify -c tools/uncrustify.cfg --no-backup --replace {} + | ||
| - name: Push changes to upstream repository | ||
| run: | | ||
| git config --global user.name 'GitHub Action' | ||
| git config --global user.email '[email protected]' | ||
| git add -A | ||
| git commit -m "Uncrustify: triggered by comment." | ||
| git push | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
18.04 is getting a bit old. Will this run on ubuntu-latest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
18.04 comes with a certain version of uncrustify. That is the one we use. That is why we stuck with using Ubuntu 18.04.