Skip to content

Instantly share code, notes, and snippets.

@chand1012
Created December 4, 2020 06:21
Show Gist options
  • Save chand1012/dbf98a658f80a4ff35f7f71dfaabf635 to your computer and use it in GitHub Desktop.
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.
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 "$GITHUB_ACTOR@users.noreply.github.com"
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:$GITHUB_TOKEN@github.com/$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