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

failing job action #10

Closed
Borda opened this issue Feb 15, 2020 · 8 comments
Closed

failing job action #10

Borda opened this issue Feb 15, 2020 · 8 comments

Comments

@Borda
Copy link

Borda commented Feb 15, 2020

Hello and thanx for this nice tool.
I wanted to add it our project, but it fails with a message I don't know how to interpret... I have added the example to workflows and open PR which triggers the action job and then I got this error:

/usr/bin/docker run --name e87b527fc098e2c9b441b99e634ffe3814c665_f9dce4 --label e87b52 --workdir /github/workspace --rm -e INPUT_DOCS-FOLDER -e INPUT_REPO-TOKEN -e INPUT_BUILD-COMMAND -e INPUT_PRE-BUILD-COMMAND -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/pytorch-lightning/pytorch-lightning":"/github/workspace" e87b52:7fc098e2c9b441b99e634ffe3814c665
Running: 
{'message': 'Resource not accessible by integration', 'documentation_url': 'https://developer.github.com/v3/checks/runs/#create-a-check-run'}
Traceback (most recent call last):
  File "/entrypoint.py", line 27, in <module>
    action.build_all_docs(github_env, [os.environ.get('INPUT_DOCS-FOLDER')])
  File "/sphinx_action/action.py", line 125, in build_all_docs
    status_id = status_check.create_in_progress_status_check(
  File "/sphinx_action/status_check.py", line 64, in create_in_progress_status_check
    r.raise_for_status()
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.github.com/repos/PyTorchLightning/pytorch-lightning/check-runs

What I am doing wrong?

@ammaraskar
Copy link
Owner

ammaraskar commented Feb 15, 2020

Hey @Borda, this is failing because when you run the action from a pull request, it doesn't have access to the GITHUB_TOKEN. This is done for security reasons so you can't make a pull request that modifies the original repo. If you run this action in a repo you own it should work.

@Borda
Copy link
Author

Borda commented Feb 15, 2020

Thx for so fast reply. Just to clarify, when this is in master and a new PR is created, then the docs check is applied on the PR not master, right?

@ammaraskar
Copy link
Owner

Just to clarify, when this is in master and a new PR is created, then the docs check is applied on the PR not master, right?

That is correct.

There is another issue though, essentially when someone else makes a pull request it isn't possible to make a status check: https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#permissions-for-the-github_token

It only gets READ access to status checks. This is why for example https://github.com/Borda/pytorch-lightning/pull/2/checks?check_run_id=448197484 fails as well.

Let me think about how to solve this.

@ammaraskar
Copy link
Owner

Yeah I've been able to re-create this locally here: https://github.com/ammaraskar/sphinx-action-test/pull/4/checks?check_run_id=448260376

Notice how this fails because it is from a fork but ammaraskar/sphinx-action-test#3 which is a pull request from the original repo succeeds.

@Borda
Copy link
Author

Borda commented Feb 15, 2020

so from forks, it will fail always? :(

@ammaraskar
Copy link
Owner

Working on a solution this now that should work from forks :)

@Borda
Copy link
Author

Borda commented Feb 15, 2020

That would be super cool! Could you ping me when you have it... Thx

@ammaraskar
Copy link
Owner

Thank you very much for the report @Borda! This helped me simplify my code a bunch thanks to a new warnings API that Github Actions introduced.

Take a look at https://github.com/Borda/pytorch-lightning/pull/2 now :)

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

2 participants