-
Notifications
You must be signed in to change notification settings - Fork 2
47 lines (38 loc) · 1.15 KB
/
beautify.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
47
name: Beautify
on:
workflow_call:
jobs:
# the jobs below are taken from the actions in https://github.com/relekang/python-semantic-release under MIT License
beautify:
name: Beautify
runs-on: ubuntu-latest
concurrency: push
outputs:
new_sha: ${{ steps.sha.outputs.SHA }}
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11.x
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Black
run: python -m pip install black
- name: Beautify with Black
run: python -m black .
- name: Install isort
run: python -m pip install isort
- name: Sort imports
run: python -m isort --profile black .
- name: Commit and push changes
uses: actions-x/commit@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
message: 'style: beautify ${{ github.sha }}'
name: github-actions
email: action@github.com
- name: Get new SHA
id: sha
run: |
new_sha=$(git rev-parse HEAD)
echo "SHA=$new_sha" >> $GITHUB_OUTPUT