Skip to content

Commit 107e1e1

Browse files
authored
Merge pull request #830 from atlanhq/BLDX-707
BLDX-707 | Format automated sync model PRs
2 parents 2b46f7b + afe5e4f commit 107e1e1

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Format Sync Models PR
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
paths:
8+
- "pyatlan_v9/model/assets/**"
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
format:
15+
# Only run on automated sync branches
16+
if: startsWith(github.head_ref, 'sync-models-')
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout PR branch
21+
uses: actions/checkout@v5
22+
with:
23+
ref: ${{ github.head_ref }}
24+
token: ${{ secrets.ORG_PAT_GITHUB }}
25+
fetch-depth: 1
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: "3.12"
31+
32+
- name: Run pre-commit
33+
uses: pre-commit/action@v3.0.1
34+
with:
35+
extra_args: --all-files
36+
continue-on-error: true
37+
38+
- name: Commit and push formatting changes
39+
run: |
40+
git config user.name "github-actions[bot]"
41+
git config user.email "github-actions[bot]@users.noreply.github.com"
42+
43+
if [ -n "$(git status --porcelain)" ]; then
44+
git add -A
45+
git commit -m "Apply pre-commit formatting to synced models
46+
47+
Co-Authored-By: github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
48+
git push
49+
echo "Formatting changes committed and pushed."
50+
else
51+
echo "No formatting changes needed."
52+
fi

0 commit comments

Comments
 (0)