File tree Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -155,15 +155,28 @@ jobs:
155155 - name : Convert notebooks to markdown files
156156 if : inputs.convert_notebooks
157157 run : |
158+ initial_work_dir=$(pwd)
158159 cd ${{ env.doc_folder }}
159160 remote_url=$(git remote get-url origin)
160161 trimmed_url=${remote_url#https://}
161162 trimmed_url=${trimmed_url#github.com/}
162163 trimmed_url=${trimmed_url%.git}
163164 current_branch=$(git branch --show-current)
164- cd ..
165+ cd $initial_work_dir
166+
167+ directory_string="${{ env.doc_folder }}"
168+ if [[ "$directory_string" == *"/"* ]]; then
169+ # directory_string contains "/"
170+ remaining_part=${directory_string#*/}
171+ if [[ -n $remaining_part ]]; then
172+ remaining_part="/$remaining_part"
173+ fi
174+ else
175+ # directory_string does not contain "/"
176+ remaining_part=""
177+ fi
165178
166- doc-builder notebook-to-mdx ${{ env.doc_folder }} --open_notebook_prefix https://colab.research.google.com/github/$trimmed_url/blob/$current_branch
179+ doc-builder notebook-to-mdx ${{ env.doc_folder }} --open_notebook_prefix https://colab.research.google.com/github/$trimmed_url/blob/$current_branch$remaining_part
167180
168181 - name : Make documentation
169182 shell : bash
Original file line number Diff line number Diff line change @@ -141,15 +141,28 @@ jobs:
141141 - name : Convert notebooks to markdown files
142142 if : inputs.convert_notebooks
143143 run : |
144+ initial_work_dir=$(pwd)
144145 cd ${{ env.doc_folder }}
145146 remote_url=$(git remote get-url origin)
146147 trimmed_url=${remote_url#https://}
147148 trimmed_url=${trimmed_url#github.com/}
148149 trimmed_url=${trimmed_url%.git}
149150 current_branch=$(git branch --show-current)
150- cd ..
151+ cd $initial_work_dir
152+
153+ directory_string="${{ env.doc_folder }}"
154+ if [[ "$directory_string" == *"/"* ]]; then
155+ # directory_string contains "/"
156+ remaining_part=${directory_string#*/}
157+ if [[ -n $remaining_part ]]; then
158+ remaining_part="/$remaining_part"
159+ fi
160+ else
161+ # directory_string does not contain "/"
162+ remaining_part=""
163+ fi
151164
152- doc-builder notebook-to-mdx ${{ env.doc_folder }} --open_notebook_prefix https://colab.research.google.com/github/$trimmed_url/blob/$current_branch
165+ doc-builder notebook-to-mdx ${{ env.doc_folder }} --open_notebook_prefix https://colab.research.google.com/github/$trimmed_url/blob/$current_branch$remaining_part
153166
154167 - name : Make documentation
155168 env :
You can’t perform that action at this time.
0 commit comments