Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Touching up automation for prod #402

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions .github/workflows/add-markdown-examples-to-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
paths:
- 'examples/**'
- 'docs/v1/examples/**'
- '.github/workflows/add-markdown-examples-to-docs.yml'

permissions:
contents: write
Expand Down Expand Up @@ -43,8 +44,10 @@ jobs:
echo "Converting notebook to markdown"
jupyter nbconvert --to markdown "$source_file" || { echo "Error: Failed to convert $source_file" >&2; continue; }
markdown_file="${source_file%.ipynb}.md"
echo "Removing existing content after {/* SOURCE_FILE: ... */}"
sed -i '/\{\/\* SOURCE_FILE:/,$d' "$file"
echo "Appending markdown to $file"
echo -e "\n\n" >> "$file"
echo -e "\n{/* SOURCE_FILE: $source_file */}\n" >> "$file"
cat "$markdown_file" >> "$file" || { echo "Error: Failed to append markdown to $file" >&2; continue; }
rm "$markdown_file" || { echo "Error: Failed to remove $markdown_file" >&2; continue; }
else
Expand All @@ -59,19 +62,8 @@ jobs:
git add docs/v1/examples/*.mdx
git diff --quiet && git diff --staged --quiet || git commit -m "GitHub Action: Update examples in docs from notebooks"

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
- name: Push changes
uses: ad-m/github-push-action@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update examples in docs from notebooks
title: 'Update examples in docs from notebooks'
body: |
This PR updates the examples in the docs from the corresponding notebooks.
Please review the changes before merging.
branch: update-docs-examples
base: main
# - name: Push changes
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: main
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
Loading