[llvm] ci: Fix `pr-code-format` permissions for private forks (PR #120838)

via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 21 12:31:41 PST 2024


whisperity wrote:

> So, I don't think it needs these permissions. Can you show me what failures you are seeing?

We were getting two issues. First, the inability to download the contents of the (otherwise private) repository when `pull_request_target` was being used instead of `pull_request` (indeed, the fork might be older, the branch-off point is somewhere on the 18.y version line), and the second was this:

```
Run python llvm/utils/git/code-format-helper.py
Traceback (most recent call last):
  File "/home/runner/_work/llvm-project/llvm-project/llvm/utils/git/code-format-helper.py", line 230, in <module>
    if not fmt.run(changed_files, args):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/_work/llvm-project/llvm-project/llvm/utils/git/code-format-helper.py", line 100, in run
    self.update_pr_success(args)
  File "/home/runner/_work/llvm-project/llvm-project/llvm/utils/git/code-format-helper.py", line 83, in update_pr_success
    pr = repo.get_issue(args.issue_number).as_pull_request()
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/_work/_tool/Python/3.11.11/x64/lib/python3.11/site-packages/github/Repository.py", line 2845, in get_issue
    headers, data = self._requester.requestJsonAndCheck(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/_work/_tool/Python/3.11.11/x64/lib/python3.11/site-packages/github/Requester.py", line 442, in requestJsonAndCheck
    return self.__check(
           ^^^^^^^^^^^^^
  File "/home/runner/_work/_tool/Python/3.11.11/x64/lib/python3.11/site-packages/github/Requester.py", line 487, in __check
    raise self.__createException(status, responseHeaders, data)
github.GithubException.GithubException: 403 {"message": "Resource not accessible by integration", "documentation_url": "https://docs.github.com/rest/issues/issues#get-an-issue", "status": "403"}
Error: Process completed with exit code 1.
```

https://github.com/llvm/llvm-project/pull/120838


More information about the llvm-commits mailing list