pyupio / pyup

A tool to update your project's dependencies on GitHub. Runs on pyup.io, comes with a command line interface.
https://pyup.io
MIT License
454 stars 67 forks source link

Support for running under GitHub apps #411

Open DamianZaremba opened 3 years ago

DamianZaremba commented 3 years ago

Currently you cannot execute the bot using a signed token from a GitHub app such as within GitHub actions due to the API calls which are gated by the integration flag.

Run pyup --provider=github --provider_url=https://api.github.com --repo=${GITHUB_REPOSITORY} --user-token=***
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.5/x64/bin/pyup", line 8, in <module>
    sys.exit(main())
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/pyup/cli.py", line 50, in main
    bot.update(branch=branch, initial=initial)
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/pyup/bot.py", line 123, in update
    self.apply_updates(
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/pyup/bot.py", line 173, in apply_updates
    (pr for pr in self.pull_requests if
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/pyup/bot.py", line 62, in pull_requests
    self.req_bundle.pull_requests = [
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/pyup/bot.py", line 62, in <listcomp>
    self.req_bundle.pull_requests = [
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/pyup/providers/github.py", line 293, in iter_issues
    extra_kwargs["creator"] = creator.login
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/github/AuthenticatedUser.py", line 232, in login
    self._completeIfNotSet(self._login)
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/github/GithubObject.py", line 299, in _completeIfNotSet
    self._completeIfNeeded()
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/github/GithubObject.py", line 303, in _completeIfNeeded
    self.__complete()
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/github/GithubObject.py", line 310, in __complete
    headers, data = self._requester.requestJsonAndCheck("GET", self._url.value)
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/github/Requester.py", line 317, in requestJsonAndCheck
    return self.__check(
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/github/Requester.py", line 342, 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/users#get-the-authenticated-user"}