Uncrustify check #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
- name: Run Uncrustify | |
run: | | |
uncrustify --version | |
find . -iname "*.[hc]" -exec uncrustify -c tools/uncrustify.cfg --no-backup --replace {} + | |
find . -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 'action@github.com' | |
git add -A | |
git commit -m "Uncrustify: triggered by comment." | |
git push |