vsoch / pull-request-action

open a pull request when a branch is pushed or updated
https://github.com/marketplace/actions/pull-request-action
MIT License
173 stars 62 forks source link

[Chore] Provide token when getting 401 error #88

Closed ohenak closed 1 year ago

ohenak commented 1 year ago

Issue #87

In GHE, token is necessary when querying the repo API, When it fails, it returns 401 error. Will need to specify the token in this case.

Before the fix:

pull-request-action on  fix/ghe-get-401-error [!] via 🐍 v2.7.18 via 💎 v2.7.0
❯ python3 pull-request.py
==========================================================================
START: Running Pull Request on Branch Update Action!
Found ${GITHUB_EVENT_PATH} at /Users/hokho/workspace/pull-request-action
Branch prefix is
No branch prefix is set, all branches will be used.
Unable to retrieve default branch: 401: Unauthorized
 {'message': 'Must authenticate to access this API.', 'documentation_url': 'https://docs.github.com/enterprise/3.3/rest'}

After the fix:

pull-request-action on  fix/ghe-get-401-error [!] via 🐍 v2.7.18 via 💎 v2.7.0
❯ python3 pull-request.py
==========================================================================
START: Running Pull Request on Branch Update Action!
Found ${GITHUB_EVENT_PATH} at /Users/hokho/workspace/pull-request-action
Branch prefix is
No branch prefix is set, all branches will be used.
Found default branch: develop
Pull requests will go to develop
vsoch commented 1 year ago

Thank you! Would you mind using your branch for your PR and showing (link here or screenshot) that it fixes the issue? I'm off to bed but will be back later after the next work day. Thanks for opening the PR! :partying_face:

ohenak commented 1 year ago

Thank you! Would you mind using your branch for your PR and showing (link here or screenshot) that it fixes the issue? I'm off to bed but will be back later after the next work day. Thanks for opening the PR! 🥳

Updated the description. Let me know if that works. I just run it in the console manually.