File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -74,14 +74,15 @@ runs:
7474 script : |
7575 const fs = require('fs')
7676 const title = `Signing event: ${process.env.GITHUB_REF_NAME}`
77- const repo = `${context.repo.owner}/${context.repo.repo}`
78- const prs = await github.rest.search.issuesAndPullRequests({
79- q: `in:title+"${title}"+state:open+type:pr+repo:${repo}`
77+ const prs = await github.rest.repos.listPullRequestsAssociatedWithCommit({
78+ owner: context.repo.owner,
79+ repo: context.repo.repo,
80+ commit_sha: context.sha
8081 })
8182
82- if (prs.data.total_count > 1) {
83- core.setFailed("Found more than one open pull request with same title ")
84- } else if (prs.data.total_count == 0) {
83+ if (prs.data.length > 1) {
84+ core.setFailed("Found more than one open pull request the current commit ")
85+ } else if (prs.data.length == 0) {
8586 const response = await github.rest.pulls.create({
8687 owner: context.repo.owner,
8788 repo: context.repo.repo,
9495 pr = response.data.number
9596 console.log(`Created pull request #${pr}`)
9697 } else {
97- pr = prs.data.items [0].number
98+ pr = prs.data[0].number
9899 console.log(`Found existing pull request #${pr}`)
99100 }
100101
You can’t perform that action at this time.
0 commit comments