@@ -159,13 +159,14 @@ def button_colab(args):
159
159
"""Test that the URL in the Colab button matches the file path."""
160
160
cell_source = args ["cell_source" ]
161
161
repo = get_arg_or_fail (args ["user" ], "repo" , "<org/name>" )
162
+ branch = args ["user" ].get ("branch" , "master" )
162
163
docs_dir , rel_path = split_doc_path (args ["path" ])
163
164
164
165
# Buttons use OSS URLs.
165
166
if str (docs_dir ) == "g3doc/en" :
166
167
docs_dir = pathlib .Path ("site/en" )
167
168
168
- base_url = f"colab.research.google.com/github/{ repo } /blob/master "
169
+ base_url = f"colab.research.google.com/github/{ repo } /blob/{ branch } "
169
170
this_url = "https://" + str (base_url / docs_dir / rel_path )
170
171
171
172
if is_button_cell_re .search (cell_source ) and cell_source .find (this_url ) != - 1 :
@@ -216,13 +217,14 @@ def button_github(args):
216
217
"""Test that the URL in the GitHub button matches the file path."""
217
218
cell_source = args ["cell_source" ]
218
219
repo = get_arg_or_fail (args ["user" ], "repo" , "<org/name>" )
220
+ branch = args ["user" ].get ("branch" , "master" )
219
221
docs_dir , rel_path = split_doc_path (args ["path" ])
220
222
221
223
# Buttons use OSS URLs.
222
224
if str (docs_dir ) == "g3doc/en" :
223
225
docs_dir = pathlib .Path ("site/en" )
224
226
225
- base_url = f"github.com/{ repo } /blob/master "
227
+ base_url = f"github.com/{ repo } /blob/{ branch } "
226
228
this_url = "https://" + str (base_url / docs_dir / rel_path )
227
229
228
230
if is_button_cell_re .search (cell_source ) and cell_source .find (this_url ) != - 1 :
0 commit comments