1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00
lvgl/.github/workflows/handle_format_request.yml
2021-12-12 21:52:31 -05:00

47 lines
1.5 KiB
YAML

name: Reformat PR code
on:
issue_comment:
types: [created]
jobs:
update-formatting:
continue-on-error: true
if: github.event.issue.user.login == 'embeddedt'
runs-on: ubuntu-latest
steps:
- uses: khan/pull-request-comment-trigger@bb03972cc9f423111f3b5a23fcc9fd32741acabb
if: success()
id: check-comment
with:
trigger: '@lvgl-bot format'
prefix_only: true
reaction: rocket
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- run: exit 1
if: steps.check-comment.outputs.triggered == 'false'
- name: Install astyle
if: success()
run: |
sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
sudo apt-get update -y -qq
sudo apt-get install astyle
- uses: actions/checkout@v2
if: success()
with:
token: ${{ secrets.LVGL_BOT_TOKEN }}
- name: Checkout pull request
if: success()
env:
GITHUB_TOKEN: ${{secrets.LVGL_BOT_TOKEN}}
run: hub pr checkout ${{github.event.issue.number}}
- name: Format code
run: python code-format.py
working-directory: scripts
- name: Commit changes
run: |
git config --global user.name 'lvgl-bot'
git config --global user.email 'lvgl-bot@users.noreply.github.com'
git commit -am "style automatic formatting"
git push