-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: YAPF autoformat | ||
|
||
on: | ||
push: | ||
paths: | ||
- "**.py" | ||
|
||
jobs: | ||
build: | ||
name: YAPF Formatter | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: checkout repo | ||
uses: actions/[email protected] | ||
with: | ||
repository: ${{ github.repository }} | ||
token: ${{ github.token }} | ||
|
||
# https://github.com/diegovalenzuelaiturra/yapf-action | ||
- name: YAPF Formatter | ||
uses: diegovalenzuelaiturra/yapf-action@master | ||
with: | ||
args: . --verbose --recursive --in-place --parallel | ||
|
||
- name: action metadata | ||
run: | | ||
echo -e "action : ${{ github.action }}" | ||
echo -e "actor : ${{ github.actor }}" | ||
echo -e "event_name : ${{ github.event_name }}" | ||
echo -e "job : ${{ github.job }}" | ||
echo -e "ref : ${{ github.ref }}" | ||
echo -e "repository : ${{ github.repository }}" | ||
echo -e "run_id : ${{ github.run_id }}" | ||
echo -e "sha : ${{ github.sha }}" | ||
echo -e "workflow : ${{ github.workflow }}" | ||
echo -e "workspace : ${{ github.workspace }}" | ||
|
||
- name: config github | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
|
||
- name: add changes | ||
run: | | ||
git add . | ||
|
||
- name: commit changes | ||
run: | | ||
git commit -m "Autoformatted to YAPF" --all | exit 0 | ||
|
||
# NOTE : only push changes when the source branch is being pushed to master (target branch) | ||
- name: push changes | ||
if: github.ref == 'refs/heads/master' | ||
run: | | ||
git push |