z0al / dependent-issues

📦 A GitHub Action for marking issues as dependent on another

Home Page:https://github.com/marketplace/actions/dependent-issues

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: Not found

onel0p3z opened this issue · comments

Hi @z0al!

Thank you for this nice action! I'm trying to use it but I'm getting the following error:

image

I've verified and confirmed that the secret is available to use in the action. Can you please share any tips or point me in the right direction to solve this issue? Thank you!!

commented

Hey. Thanks for reporting this!

Can you please share any tips or point me in the right direction to solve this issue?

My first guess would be that one of the dependencies declared on the issue (or PR) #292 is:

  1. not valid or
  2. inaccessible by the action due to permissions

In both cases, GitHub returns 404 - Not found error. Is possible to share the description of #292? I'm mainly concerned about the point where you declare the dependencies. If all dependencies are local (as in they all belong to the same repo) then my guess is wrong.

Thanks for the quick response! #292 is a PR in the same repo that uses the action. Would this error be consistent with a PR that was merged and no longer open? I'll try again with another and/or issue. Again, thanks for taking the time to look into this!

commented

Thanks for the quick response! #292 is a PR in the same repo that uses the action.

Yeah, that part is clear and most likely not the issue. What I'm interested in is the description of that PR @onel0p3z

If it has something like:

depends on user/another-repo#123

Then my guess is that the provided token is not sufficient to read issues of user/another-repo.

Would this error be consistent with a PR that was merged and no longer open?

No. Closing a dependency shouldn't cause any problem.

commented

Is that a public repo I can look at?

@z0al it's not on a public repo. I'll try to add the action to another repo that's public within the same org and see if I can recreate the issue there. Thank you!

Hi @z0al. Sorry for the delay. I just realized that the error is thrown whenever a PR is created and the action runs for that PR. Not sure if it's a configuration error on my side or if the action throws whenever it runs for a PR that doesn't have any keywords or labels. I haven't tried to recreate on a public repo yet. Thanks for keeping this open!

commented

Hey. No worries.

Having no keywords shouldn't throw anything really. It just means the PR has no dependencies. The Not found is an API error, the cause can be either a misconfiguration (invalid token permissions) or a bug on the action code that makes it request something it shouldn't.

commented

I will try to add more action logs on the upcoming weekend to help us identify the cause now and in future.

commented

Hey @onel0p3z . I just updated the action to log the full error stack when possible. Can you try to run it manually again in the original #292 issue and check the log?

Got a similar error when referencing a PR in an other private repository from the same organization:

HttpError: Not Found
    at /home/runner/work/_actions/z0al/dependent-issues/v1/webpack:/dependent-issues/node_modules/@octokit/request/dist-node/index.js:66:1
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Im not sure if it's the same cause as the issue reported by @onel0p3z.

The description of the pull request looks like the following:

Depends on https://github.com/orgname/repository-name/pull/1

The referenced PR is closed an merged.

Thanks in advance for your support

Got a similar error when referencing a PR in an other private repository from the same organization:

HttpError: Not Found
    at /home/runner/work/_actions/z0al/dependent-issues/v1/webpack:/dependent-issues/node_modules/@octokit/request/dist-node/index.js:66:1
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Im not sure if it's the same cause as the issue reported by @onel0p3z.

The description of the pull request looks like the following:

Depends on https://github.com/orgname/repository-name/pull/1

The referenced PR is closed an merged.

Thanks in advance for your support

I am having the exact same issue, trying to reference across an organisations repos.

commented

Got a similar error when referencing a PR in an other private repository from the same organization:

HttpError: Not Found
    at /home/runner/work/_actions/z0al/dependent-issues/v1/webpack:/dependent-issues/node_modules/@octokit/request/dist-node/index.js:66:1
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Thanks for the report @MathiasSchwaller . That's expected though, I'm assuming you're not using a Personal Access Token (PAT), right?

The solution to your issue is using a PAT with repo scope instead of the auto-generated GITHUB_TOKEN. That's because GITHUB_TOKEN only gives access to the current repo and not the whole org repos.

commented

I should probably create a FAQs section in the README later. PRs to improve that are welcome

Got a similar error when referencing a PR in an other private repository from the same organization:

HttpError: Not Found
    at /home/runner/work/_actions/z0al/dependent-issues/v1/webpack:/dependent-issues/node_modules/@octokit/request/dist-node/index.js:66:1
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Thanks for the report @MathiasSchwaller . That's expected though, I'm assuming you're not using a Personal Access Token (PAT), right?

The solution to your issue is using a PAT with repo scope instead of the auto-generated GITHUB_TOKEN. That's because GITHUB_TOKEN only gives access to the current repo and not the whole org repos.

Thank you for the fast response.

Yes i was using the default GITHUB_TOKEN, but because of security concerns i can't switch to a PAT token with repo access. A PAT with repo:status access ins't sufficient for the action (i'm not that familiar with PATs and the documentation isn't that specific about the different scopes)?

I'm going to create a FAQ for cross-repository-dependencies later in the evening.

@z0al my issue was definitely the same as @MathiasSchwaller. After updating the token with a PAT, the error went away and the action finished without an issue. Thanks for all the help and patience! I'll go ahead and close this issue. @MathiasSchwaller thanks for adding the FAQ in #109 ❤️

commented

A PAT with repo:status access ins't sufficient for the action?

I understand your concern @MathiasSchwaller , but I'm afraid the PAT token scopes are not that flexible. What this Action needs is permission to do the followings:

  • Update PR commit status (the repo:status should be enough for this part)
  • Update labels
  • Write comments

What I'd do in your case is to simply review the code and then fork the repo and run your own fork, which is fairly easy to do. Luckily, there isn't much going on on this repo code-wise so you don't have to update your fork as often (you can safely ignore Dependabot PRs). You could watch "Releases" and update accordingly.

watch

Hey z0al, I've tried to use a PAT in your action, but I still run into problems, it won't let me access the other repo. I just replaced the "GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}" with the PAT. Is this the correct approach?

Thanks!

commented

Yeah, that sounds about right @KillWolf, maybe double-check the token has repo scope?. You can also check this guide in the FAQs (thanks to @mathias-schwaller )