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

[Fix] notebook-to-mdx colab link creation workflow #474

Merged
merged 2 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
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
17 changes: 15 additions & 2 deletions .github/workflows/build_main_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,28 @@ jobs:
- name: Convert notebooks to markdown files
if: inputs.convert_notebooks
run: |
initial_work_dir=$(pwd)
cd ${{ env.doc_folder }}
remote_url=$(git remote get-url origin)
trimmed_url=${remote_url#https://}
trimmed_url=${trimmed_url#github.com/}
trimmed_url=${trimmed_url%.git}
current_branch=$(git branch --show-current)
cd ..
cd $initial_work_dir

directory_string="${{ env.doc_folder }}"
if [[ "$directory_string" == *"/"* ]]; then
# directory_string contains "/"
remaining_part=${directory_string#*/}
if [[ -n $remaining_part ]]; then
remaining_part="/$remaining_part"
fi
else
# directory_string does not contain "/"
remaining_part=""
fi

doc-builder notebook-to-mdx ${{ env.doc_folder }} --open_notebook_prefix https://colab.research.google.com/github/$trimmed_url/blob/$current_branch
doc-builder notebook-to-mdx ${{ env.doc_folder }} --open_notebook_prefix https://colab.research.google.com/github/$trimmed_url/blob/$current_branch$remaining_part

- name: Make documentation
shell: bash
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/build_pr_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,28 @@ jobs:
- name: Convert notebooks to markdown files
if: inputs.convert_notebooks
run: |
initial_work_dir=$(pwd)
cd ${{ env.doc_folder }}
remote_url=$(git remote get-url origin)
trimmed_url=${remote_url#https://}
trimmed_url=${trimmed_url#github.com/}
trimmed_url=${trimmed_url%.git}
current_branch=$(git branch --show-current)
cd ..
cd $initial_work_dir

directory_string="${{ env.doc_folder }}"
if [[ "$directory_string" == *"/"* ]]; then
# directory_string contains "/"
remaining_part=${directory_string#*/}
if [[ -n $remaining_part ]]; then
remaining_part="/$remaining_part"
fi
else
# directory_string does not contain "/"
remaining_part=""
fi

doc-builder notebook-to-mdx ${{ env.doc_folder }} --open_notebook_prefix https://colab.research.google.com/github/$trimmed_url/blob/$current_branch
doc-builder notebook-to-mdx ${{ env.doc_folder }} --open_notebook_prefix https://colab.research.google.com/github/$trimmed_url/blob/$current_branch$remaining_part

- name: Make documentation
env:
Expand Down
Loading