Skip to content

Commit

Permalink
Merge pull request #34 from jku/use-repos-api
Browse files Browse the repository at this point in the history
actions: Use repos API instead of search API
  • Loading branch information
jku authored Jan 30, 2024
2 parents 9eb98c9 + 37bbced commit 2102a43
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions actions/signing-event/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@ runs:
issue = 0
const repo = context.repo.owner + "/" + context.repo.repo
const issues = await github.rest.search.issuesAndPullRequests({
q: "label:" + process.env.GITHUB_REF_NAME + "+state:open+type:issue+repo:" + repo,
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
labels: [process.env.GITHUB_REF_NAME],
})
if (issues.data.total_count > 1) {
if (issues.data.length > 1) {
core.setFailed("Found more than one issue with same label")
} else if (issues.data.total_count == 0) {
} else if (issues.data.length == 0) {
const response = await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -88,7 +90,7 @@ runs:
issue = response.data.number
console.log("Created issue #" + issue)
} else {
issue = issues.data.items[0].number
issue = issues.data[0].number
console.log("Found existing issue #" + issue)
}
Expand Down

0 comments on commit 2102a43

Please sign in to comment.