| 19 | |
| 20 | // https://docs.github.com/rest/reference/git#list-matching-references |
| 21 | export async function listMatchingRefs(owner, repo, ref) { |
| 22 | try { |
| 23 | // if the ref is found, this returns an array of objects; |
| 24 | // if the ref is not found, this returns an empty array |
| 25 | const { data } = await github.git.listMatchingRefs({ |
| 26 | owner, |
| 27 | repo, |
| 28 | ref, |
| 29 | }) |
| 30 | return data |
| 31 | } catch (err) { |
| 32 | console.log('error getting tree') |
| 33 | throw err |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | // https://docs.github.com/rest/reference/git#get-a-commit |
| 38 | export async function getTreeSha(owner, repo, commitSha) { |