Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working for PRs with branches from forks #10

Closed
janpio opened this issue Feb 22, 2020 · 5 comments
Closed

Not working for PRs with branches from forks #10

janpio opened this issue Feb 22, 2020 · 5 comments

Comments

@janpio
Copy link

janpio commented Feb 22, 2020

Thanks for this great Action!

I recently added it to https://github.com/fastlane/fastlane/. Unfortunately it seems it only works with PRs for branches of the same repository, not for the many PRs from third party forks and their branches.

Am I doing something wrong or is this expected?

https://github.com/fastlane/fastlane/blob/master/.github/workflows/size-label.yml

https://github.com/fastlane/fastlane/actions?query=workflow%3Asize-label
fastlane/fastlane#16070

@pascalgn
Copy link
Owner

I'm afraid that's expected behaviour. It's related to how GH handles actions for forked repositories.

For some more information you could have a look at this related issue from another action: pascalgn/automerge-action#46

I'm really sorry about that, but I'm afraid there's not much I can do about it. If you have any ideas on how to solve this problem, I would be happy to hear them!

@janpio
Copy link
Author

janpio commented Feb 22, 2020

Thanks @pascalgn, that's unfortunate. You might want to add it to the Action description.


I investigated a bit more:

After the first few failures, we changed from the normal GITHUB_TOKEN to ours that we are using for other issue related Actions. That leads to this error:

https://github.com/fastlane/fastlane/runs/462203915?check_suite_focus=true

Run pascalgn/size-label-action@df7ad4303b35cbeb20937dbb12d5a050520e469e
/usr/bin/docker run --name e87b529cbecee79e0b47278e92af16f3767d94_b057d1 --label e87b52 --workdir /github/workspace --rm -e GITHUB_TOKEN -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e GITHUB_ACTIONS=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/fastlane/fastlane":"/github/workspace" e87b52:9cbecee79e0b47278e92af16f3767d94
Error: Environment variable GITHUB_TOKEN not set!
    at main (/usr/local/share/.config/yarn/global/node_modules/size-label-action/index.js:28:11)
    at Object.<anonymous> (/usr/local/share/.config/yarn/global/node_modules/size-label-action/index.js:197:3)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Module.load (internal/modules/cjs/loader.js:685:32)
    at Function.Module._load (internal/modules/cjs/loader.js:620:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:877:12)
    at internal/main/run_main_module.js:21:11

This is of course can not work.

But before that, the error looks like that:

https://github.com/fastlane/fastlane/runs/451209007?check_suite_focus=true

Run pascalgn/size-label-action@df7ad4303b35cbeb20937dbb12d5a050520e469e
/usr/bin/docker run --name dfb1b5160b021ce4a27a8c524123950d4df_796cf0 --label 488dfb --workdir /github/workspace --rm -e GITHUB_TOKEN -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e GITHUB_ACTIONS=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/fastlane/fastlane":"/github/workspace" 488dfb:1b5160b021ce4a27a8c524123950d4df
Changed lines: 26
Matching label: size/S
{ RequestError [HttpError]: Resource not accessible by integration
    at response.text.then.message (/usr/local/share/.config/yarn/global/node_modules/@octokit/request/dist-node/index.js:66:23)
    at processTicksAndRejections (internal/process/task_queues.js:86:5)
  name: 'HttpError',
  status: 403,
  headers:
   { 'access-control-allow-origin': '*',
     'access-control-expose-headers':
      'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
     connection: 'close',
     'content-encoding': 'gzip',
     'content-security-policy': "default-src 'none'",
     'content-type': 'application/json; charset=utf-8',
     date: 'Mon, 17 Feb 2020 18:43:40 GMT',
     'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
     server: 'GitHub.com',
     status: '403 Forbidden',
     'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
     'transfer-encoding': 'chunked',
     vary: 'Accept-Encoding, Accept, X-Requested-With',
     'x-content-type-options': 'nosniff',
     'x-frame-options': 'deny',

Did you already investigate what exactly is throwing this error and why? I am not sure I found the exact thing that applies here in the linked thread.

@pascalgn
Copy link
Owner

Yeah, I'm not sure if that makes it better or worse. If I understand the docs correctly, the "default" GITHUB_TOKEN at least has read-only access to forked repositories in some cases. This is probably not true for personal access tokens.

I understand the reasoning behind some of the decisions around GH actions and forked repositories, but I think the current state makes a lot of common use cases impossible 😞

@andreamussap
Copy link

Same issue here! Unfortunately just saw the problem after having installed the Action in my repo (which is an open source project where people create forks for their collaboration).

Agree with @janpio that you should add this restriction to the Action description.

@pascalgn
Copy link
Owner

I think this is not yet fixed, or at least it's not clear what the cause for the problem is. However, it's a long time since there was some activity in this issue, so I will close it for now. If you have any new information or need any help, feel free to reopen this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants