-
Notifications
You must be signed in to change notification settings - Fork 19
53 lines (44 loc) · 1.26 KB
/
check-python-code-snippets.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
48
49
50
51
52
53
name: check-python-code-snippets
on:
pull_request:
branches:
- main
paths:
- 'fern/pages/**/*.mdx'
- 'fern/pages/**/**/*.mdx'
jobs:
run:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Poetry
shell: bash
run: |
pipx install poetry
- name: Install Project Dependencies with Poetry
shell: bash
run: |
poetry install
- name: Run Python MDX Snippet Formatter
shell: bash
run: poetry run python .github/scripts/check_python_code_snippets.py fern/pages
- name: Check for changes
id: diff
run: |
git diff --exit-code || echo "::set-output name=changes::true"
- name: Commit and Push Changes
if: steps.diff.outputs.changes == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -u
git commit -m "Format Python snippets in MDX files"
git push