Skip to content

Commit 2102a43

Browse files
authored
Merge pull request #34 from jku/use-repos-api
actions: Use repos API instead of search API
2 parents 9eb98c9 + 37bbced commit 2102a43

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

actions/signing-event/action.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,14 @@ runs:
7272
7373
issue = 0
7474
const repo = context.repo.owner + "/" + context.repo.repo
75-
const issues = await github.rest.search.issuesAndPullRequests({
76-
q: "label:" + process.env.GITHUB_REF_NAME + "+state:open+type:issue+repo:" + repo,
75+
const issues = await github.rest.issues.listForRepo({
76+
owner: context.repo.owner,
77+
repo: context.repo.repo,
78+
labels: [process.env.GITHUB_REF_NAME],
7779
})
78-
if (issues.data.total_count > 1) {
80+
if (issues.data.length > 1) {
7981
core.setFailed("Found more than one issue with same label")
80-
} else if (issues.data.total_count == 0) {
82+
} else if (issues.data.length == 0) {
8183
const response = await github.rest.issues.create({
8284
owner: context.repo.owner,
8385
repo: context.repo.repo,
@@ -88,7 +90,7 @@ runs:
8890
issue = response.data.number
8991
console.log("Created issue #" + issue)
9092
} else {
91-
issue = issues.data.items[0].number
93+
issue = issues.data[0].number
9294
console.log("Found existing issue #" + issue)
9395
}
9496

0 commit comments

Comments
 (0)