Skip to content

Commit 7aaa82f

Browse files
authored
Auto Format Python Code
1 parent b268c62 commit 7aaa82f

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/code_format.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Auto Format Code
2+
3+
on: push
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: actions/setup-python@v5.4.0
11+
with:
12+
python-version: "3.13"
13+
architecture: "x64"
14+
- name: install packages
15+
run: pip install black[jupyter] autopep8 isort
16+
- name: Auto format code
17+
run: |
18+
black .
19+
autopep8 --recursive --in-place --aggressive --aggressive .
20+
isort .
21+
- name: Get branch name
22+
run: |
23+
branch_name="${{ github.head_ref }}"
24+
echo "Branch name is ${branch_name}"
25+
echo "Branch name is ${{ github.event.pull_request.title }}"
26+
- name: Create Pull Request
27+
uses: peter-evans/create-pull-request@v7.0.6
28+
env:
29+
TITLE: ${{ github.event.pull_request.title }}
30+
with:
31+
token: ${{ secrets.ROCM_BLOG_PAT }}
32+
commit-message: Auto Code Format
33+
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
34+
title: Black Auto format for ${{ env.TITLE }}
35+
body: Auto-Generated Pull Request
36+
reviewers: "Saad Rahim (AMD) <44449863+saadrahim@users.noreply.github.com>"
37+
maintainer-can-modify: true
38+
labels: Backend
39+
branch: python-code-format${{ github.event.pull_request.number }}
40+

0 commit comments

Comments
 (0)