-
Notifications
You must be signed in to change notification settings - Fork 20
72 lines (61 loc) · 1.92 KB
/
build-cookbooks.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: generate-mdx-files
on:
pull_request:
branches:
- main
paths:
- 'fern/pages/cookbooks/**/*.mdx'
- 'scripts/build-cookbooks/**/*'
jobs:
run:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- 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 mypy
# id: check_mypy
# run: |
# if grep -q 'mypy' pyproject.toml; then
# echo "mypy is specified in pyproject.toml, running..."
# poetry run mypy .
# echo "mypy_run=true" >> $GITHUB_ENV
# else
# echo "mypy is not specified in pyproject.toml, exiting."
# echo "mypy_run=false" >> $GITHUB_ENV
# fi
# shell: bash
- name: Build MDX Files
#if: env.mypy_run == 'true'
run: poetry run python scripts/build-cookbooks/build.py
shell: bash
- name: Check for Changes in build-mdx Folder
id: check_changes
shell: bash
run: |
git add fern/pages/cookbooks* # Ensure this path is correct
git diff --cached --exit-code || echo "::set-output name=changes_detected::true"
continue-on-error: true
- name: Commit and Push Changes
if: steps.check_changes.outputs.changes_detected == 'true'
shell: bash
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git commit -m "Update cookbooks"
git push origin HEAD:refs/heads/${{ github.head_ref }}