-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) · 1.18 KB
/
python-pr.yml
File metadata and controls
49 lines (40 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Python PR Workflow
on:
pull_request:
branches:
- main
permissions:
contents: write # Grant write access to the repository
jobs:
autopep8:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
ref: dev # Ensure we're checking out the dev branch
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install autopep8
- name: Run autopep8
run: autopep8 --in-place --aggressive --aggressive -r src
- name: Pull remote changes from dev
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git pull origin dev
- name: Commit changes
run: |
git add -A
git diff-index --quiet HEAD || git commit -m "Apply autopep8 formatting"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_TOKEN }}
branch: dev