Skip to content

Commit 8a8115b

Browse files
authored
Merge pull request #350 from tyeth/fix-hardcoded-master
Fix: master branch to repo["default_branch"]
2 parents bfeb949 + 37f05c8 commit 8a8115b

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

adabot/arduino_libraries.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ def is_arduino_library(repo):
8484
lib_prop_file = requests.get(
8585
"https://raw.githubusercontent.com/adafruit/"
8686
+ repo["name"]
87-
+ "/master/library.properties"
87+
+ "/"
88+
+ repo["default_branch"]
89+
+ "/library.properties"
8890
)
8991
return lib_prop_file.ok
9092

@@ -112,7 +114,9 @@ def validate_library_properties(repo):
112114
lib_prop_file = requests.get(
113115
"https://raw.githubusercontent.com/adafruit/"
114116
+ repo["name"]
115-
+ "/master/library.properties"
117+
+ "/"
118+
+ repo["default_branch"]
119+
+ "/library.properties"
116120
)
117121
if not lib_prop_file.ok:
118122
# print("{} skipped".format(repo["name"]))
@@ -152,22 +156,29 @@ def validate_release_state(repo):
152156
return None
153157

154158
compare_tags = gh_reqs.get(
155-
"/repos/" + repo["full_name"] + "/compare/master..." + repo["tag_name"]
159+
"/repos/"
160+
+ repo["full_name"]
161+
+ "/compare/"
162+
+ repo["default_branch"]
163+
+ "..."
164+
+ repo["tag_name"]
156165
)
157166
if not compare_tags.ok:
158167
logger.error(
159-
"Error: failed to compare %s 'master' to tag '%s'",
168+
"Error: failed to compare %s '%s' to tag '%s'",
160169
repo["name"],
170+
repo["default_branch"],
161171
repo["tag_name"],
162172
)
163173
return None
164174
compare_tags_json = compare_tags.json()
165175
if "status" in compare_tags_json:
166-
if compare_tags.json()["status"] != "identical":
176+
if compare_tags_json["status"] != "identical":
167177
return [repo["tag_name"], compare_tags_json["behind_by"]]
168178
elif "errors" in compare_tags_json:
169179
logger.error(
170-
"Error: comparing latest release to 'master' failed on '%s'. Error Message: %s",
180+
"Error: comparing latest release to '%s' failed on '%s'. Error Message: %s",
181+
repo["default_branch"],
171182
repo["name"],
172183
compare_tags_json["message"],
173184
)
@@ -180,7 +191,9 @@ def validate_actions(repo):
180191
repo_has_actions = requests.get(
181192
"https://raw.githubusercontent.com/adafruit/"
182193
+ repo["name"]
183-
+ "/master/.github/workflows/githubci.yml"
194+
+ "/"
195+
+ repo["default_branch"]
196+
+ "/.github/workflows/githubci.yml"
184197
)
185198
return repo_has_actions.ok
186199

0 commit comments

Comments
 (0)