forked from Significant-Gravitas/AutoGPT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds auto formatting for pull requests.
This is a great way to ensure that your code is formatted correctly before it is merged into the main branch and limit the number of formatting changes in pull requests.
- Loading branch information
1 parent
0a22cd6
commit f31953f
Showing
1 changed file
with
26 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,26 @@ | ||
name: auto-format | ||
on: pull_request | ||
jobs: | ||
format: | ||
# Check if the PR is not from a fork | ||
if: github.event.pull_request.head.repo.full_name == github.repository | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- name: autopep8 | ||
uses: peter-evans/autopep8@v1 | ||
with: | ||
args: --exit-code --recursive --in-place --aggressive --aggressive . | ||
- name: Check for modified files | ||
id: git-check | ||
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT | ||
- name: Push changes | ||
if: steps.git-check.outputs.modified == 'true' | ||
run: | | ||
git config --global user.name 'Torantulino' | ||
git config --global user.email '[email protected]' | ||
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | ||
git commit -am "Automated changes" | ||
git push |