1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00
lvgl/.github/workflows/handle_format_request.yml
2021-12-12 21:35:18 -05:00

46 lines
1.5 KiB
YAML

name: Reformat PR code
on:
issue_comment:
types: [created]
jobs:
test-github:
runs-on: ubuntu-latest
steps:
- run: echo '${{ toJSON(github) }}'
update-formatting:
continue-on-error: true
if: github.event.issue.pull_request && github.event.issue.user.login == github.event.pull_request.user.login
runs-on: ubuntu-latest
steps:
- uses: khan/pull-request-comment-trigger@bb03972cc9f423111f3b5a23fcc9fd32741acabb
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.outputs.triggered != 'true'
- name: Install astyle
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: xt0rted/pull-request-comment-branch@v1
id: comment-branch
- uses: actions/checkout@v2
if: success()
with:
ref: ${{ steps.comment-branch.outputs.head_ref }}
- 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