Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Auto-Detect PR error on Workflow dispatch, resource not accessible #1208

@Cellule

Description

@Cellule

Since there's no PR information on a workflow_dispatch the action will try to fetch it

github-action/index.js

Lines 474 to 497 in f6f2cc1

try {
const resp = await client.request(
'GET /repos/:owner/:repo/commits/:commit_sha/pulls',
{
owner,
repo,
commit_sha: GITHUB_SHA
}
)
if (
resp &&
resp.data &&
resp.data[0] &&
resp.data[0].number
) {
prNumber = resp.data[0].number
}
} catch (e) {
console.error(
`Unable to fetch related PR data for commit: '${GITHUB_SHA}': `,
e
)
}

However, even though the call is in a try/catch it still errors my whole run.

Unable to fetch related PR data for commit: '46a72ff9cd29aeaa59f536eee6c008e3ffbcf56d':  RequestError [HttpError]: Resource not accessible by integration
    at /home/runner/work/_actions/cypress-io/github-action/v6/dist/index.js:41343:21
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async detectPrNumber (/home/runner/work/_actions/cypress-io/github-action/v6/dist/index.js:7[48](https://github.com/MaintainX/maintainx/actions/runs/9684418723/job/26722269427#step:17:49)81:22)
    at async runTests (/home/runner/work/_actions/cypress-io/github-action/v6/dist/index.js:75152:3) {

Right now I suspect it fails because we are using the following permissions on the job

permissions:
      contents: read # Required to checkout source code
      id-token: write # Required to setup AWS credentials

I'm not sure yet which permission I need to give yet, but I would have expected that it wouldn't fail the run at least

Metadata

Metadata

Assignees

Labels

Cypress CloudbugSomething isn't workingdocumentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions