Skip to content

Commit

Permalink
remove data wrapper on paginated octokit calls
Browse files Browse the repository at this point in the history
  • Loading branch information
craig-day committed Mar 23, 2021
1 parent 232e6f7 commit 1ad670d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions action.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,26 @@ function initialTag(tag) {
}

async function existingTags() {
const { data: refs } = await octokit
return await octokit
.paginate(octokit.git.listMatchingRefs, {
...requestOpts,
ref: 'tags',
})
.then((refs) => refs.reverse())
.catch((e) => {
core.setFailed(`Failed to fetch matching refs (tags): ${e}`)
})

return refs.reverse()
}

async function commitsForBranch(branch) {
const { data: commits } = await octokit
return await octokit
.paginate(octokit.repos.listCommits, {
...requestOpts,
sha: branch,
})
.catch((e) => {
core.setFailed(`Failed to fetch commits for branch '${branch}' : ${e}`)
})

return commits
}

function semanticVersion(tag) {
Expand Down

0 comments on commit 1ad670d

Please sign in to comment.