You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
GitHub Action
YAPF Formatter
v0.0.2
Pre-release
A GitHub action that runs YAPF code formatter for Python.
It will automatically commit the changes!
On your repo, create a folder called .github/workflows/
containing a main.yml
file, with the following workflow configurations :
name: YAPF Code Formatter :)
# This workflow is triggered on pushes
on:
push:
paths:
- '**.py'
jobs:
build:
# Job name is "yapf formatter"
name: "YAPF Formatter"
# This job runs on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "Formatter Action"
# This step uses diegovalenzuelaiturra's yapf-action:
# https://github.com/diegovalenzuelaiturra/yapf-action
uses: diegovalenzuelaiturra/yapf-action@v0.0.1
with:
args: . --verbose --recursive --in-place
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit files
run: |
echo ${{ github.ref }}
git add .
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "Automated Formatter Push" -a | exit 0
- name: Push changes
if: github.ref == 'refs/heads/master'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
If you want to edit the message it will automatically commit to your repository when pushing the changes, edit the following command of the worflow to include your own custom message:
git commit -m "Automated Formatter Push" -a | exit 0
For a full list of possible args checkout the YAPF docs.