(branch, commit) for the first branch with the path: the last commit there to change anything under it.
(repo, branches, path)
| 191 | |
| 192 | |
| 193 | def resolve_path_commit_for(repo, branches, path): |
| 194 | """(branch, commit) for the first branch with the path: the last commit there to change anything under it.""" |
| 195 | for branch in branches: |
| 196 | data = get(f"https://api.github.com/repos/{repo}/commits?sha={branch}&path={path}&per_page=1", API_HEADERS) |
| 197 | commits = json.loads(data) |
| 198 | if commits: |
| 199 | return branch, commits[0]["sha"] |
| 200 | raise RuntimeError(f"No commit on {repo} ({', '.join(branches)}) touches {path}") |
| 201 | |
| 202 | |
| 203 | def sha256_of(data): |