Created
December 4, 2020 06:21
-
-
Save chand1012/dbf98a658f80a4ff35f7f71dfaabf635 to your computer and use it in GitHub Desktop.
GitHub Actions Linting Script. Could also be configured to create a PR if needed.
This file contains hidden or 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
name: Python Linting | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.7 | |
- name: Install Dependencies | |
run: | | |
pip install --no-cache-dir autopep8 | |
- name: Run AutoPEP8 | |
run: | | |
autopep8 -r --in-place --aggressive --aggressive src | |
- name: Commit and Push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config user.name "Github Action" | |
git config user.email "[email protected]" | |
git checkout `echo $GITHUB_REF | cut -d'/' -f3-` | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "there are changes"; | |
git add -A | |
git commit -m "[bot] Update production frontend files." | |
git push "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY.git" `echo $GITHUB_REF | cut -d'/' -f3-` | |
else | |
echo "no changes"; | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment