-
Notifications
You must be signed in to change notification settings - Fork 26
46 lines (38 loc) · 1.17 KB
/
fmt.yml
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
on:
push:
branches:
- main # Splitting out main here ensures we do not redundantly run this workflow on merge from a PR
pull_request:
branches:
- '*' # Match all branches
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install pipenv
run: make install-pipenv
- name: Install
run: make install
- name: Format
run: make fmt
- name: Commit formatting
run: |
git config --global user.name "panther-bot-automation"
git config --global user.email "github-service-account-automation@panther.io"
git add -A .
REQUIRES_COMMIT=1
git commit -m "Auto-format files" || REQUIRES_COMMIT=0
if [[ $REQUIRES_COMMIT -eq 0 ]]; then
echo "No auto-formatting needed"
else
echo "Committing auto-formatted files"
git push origin HEAD:${{ github.ref }}
fi
env:
GH_TOKEN: ${{ secrets.PANTHER_BOT_AUTOMATION_TOKEN }}