pygithub icon indicating copy to clipboard operation
pygithub copied to clipboard

`example-04.yml` workflow failed

Open josecelano opened this issue 3 years ago • 0 comments

The workflow failed:

https://github.com/Nautilus-Cyberneering/pygithub/runs/6231187549?check_suite_focus=true#step:4:18

It failed because we changed the default organization workflow permissions.

Run docker run --rm \
Traceback (most recent call last):
  File "/app/src/04_sign_commit_with_multiple_files_using_github_api.py", line [7](https://github.com/Nautilus-Cyberneering/pygithub/runs/6231187549?check_suite_focus=true#step:4:7)7, in <module>
    main(repo_token, branch)
  File "/app/src/04_sign_commit_with_multiple_files_using_github_api.py", line 34, in main
    blob1 = remote_repo.create_git_blob(file_to_update_01_content, "utf-[8](https://github.com/Nautilus-Cyberneering/pygithub/runs/6231187549?check_suite_focus=true#step:4:8)")
  File "/opt/venv/lib/python3.[9](https://github.com/Nautilus-Cyberneering/pygithub/runs/6231187549?check_suite_focus=true#step:4:9)/site-packages/github/Repository.py", line 908, in create_git_blob
    headers, data = self._requester.requestJsonAndCheck(
  File "/opt/venv/lib/python3.9/site-packages/github/Requester.py", line 353, in requestJsonAndCheck
    return self.__check(
  File "/opt/venv/lib/python3.9/site-packages/github/Requester.py", line 378, in __check
    raise self.__createException(status, responseHeaders, output)
github.GithubException.GithubException: 403 {"message": "Resource not accessible by integration", "documentation_url": "https://docs.github.com/rest/reference/git#create-a-blob"}
Error: Process completed with exit code 1.

We have to add the "contents: write" permission to the job.

Relates to https://github.com/Nautilus-Cyberneering/git-queue/discussions/147#discussioncomment-2601697

WE have to add this to the job:

runs-on: ubuntu-latest
permissions:
  issues: write

josecelano avatar May 02 '22 09:05 josecelano