trakt / script.trakt

Trakt.tv movie and TV show scrobbler for Kodi
GNU General Public License v2.0
315 stars 149 forks source link

Github token gives bad credentials #627

Open razzeee opened 10 months ago

razzeee commented 10 months ago

Hey @rectifyer can you check the github tokens used for https://github.com/trakt/script.trakt/actions/runs/6113115321/job/16591958743

They might be outdated/expired

rectifyer commented 10 months ago

Any idea what I need to do? I see GH_TOKEN in the repository security settings, but it hasn't changed that I'm aware of.

razzeee commented 10 months ago

I'm not sure, but aren't tokens expiring? Maybe just create a new one and set it?

razzeee commented 7 months ago

@rectifyer

razzeee commented 5 months ago

@rectifyer

rectifyer commented 5 months ago

@razzeee I updated the EMAIL and GH_TOKEN with newly generated values.

razzeee commented 5 months ago

Thank you

razzeee commented 4 months ago

@rectifyer can you check if that token has public_repo like https://github.com/xbmc/action-kodi-addon-submitter?tab=readme-ov-file#gh_token suggests?

rectifyer commented 4 months ago

image

I believe it has the correct permissions. However, this refers to GITHUB_TOKEN instead of GH_TOKEN.

razzeee commented 4 months ago

Yeah, the name mismatching like that would be a problem

rectifyer commented 4 months ago

@razzeee I believe the GITHUB_TOKEN is automatically created, so you should be able to just use it.

https://dev.to/github/the-githubtoken-in-github-actions-how-it-works-change-permissions-customizations-3cgp

razzeee commented 4 months ago

That leads us to https://github.com/trakt/script.trakt/actions/runs/8137676724/job/22236597501

rectifyer commented 4 months ago

@razzeee I've never actually used actions before. I re-ran it with debug logging and the 403 seems related to POSTing to one of the xbmc repos.

addon-submitter - INFO: Getting addon.xml file content
urllib3.connectionpool - DEBUG: Starting new HTTPS connection (1): api.github.com:443
urllib3.connectionpool - DEBUG: [https://api.github.com:443](https://api.github.com/) "GET /repos/razzeee/repo-scripts?type=all HTTP/1.1" 200 None
addon-submitter - INFO: Creating addon branch "matrix"...
addon-submitter - INFO: Addon branch "matrix" created successfully.
addon-submitter - INFO: Checking pull request...
urllib3.connectionpool - DEBUG: Starting new HTTPS connection (1): api.github.com:443
urllib3.connectionpool - DEBUG: [https://api.github.com:443](https://api.github.com/) "GET /repos/xbmc/repo-scripts/pulls?head=razzeee%3Ascript.trakt%40matrix&base=matrix HTTP/1.1" 200 2
addon-submitter - INFO: Submitting pull request...
urllib3.connectionpool - DEBUG: Starting new HTTPS connection (1): api.github.com:443
urllib3.connectionpool - DEBUG: [https://api.github.com:443](https://api.github.com/) "POST /repos/xbmc/repo-scripts/pulls HTTP/1.1" 403 None
addon-submitter - DEBUG: Pull request URL: https://api.github.com/repos/xbmc/repo-scripts/pulls

Here is what I ended up doing:

  1. Created a new classic token (https://github.com/settings/tokens/new) called XMBC_REPO with no expiration.
  2. I added a new XMBC_REPO action variable under the script.trakt project.
  3. Updated the submit.yml file to use XBMC_REPO
  4. Created a new tag v3.6.8
  5. Action ran and created pull request https://github.com/xbmc/repo-scripts/pull/2593

Hopefully that did what it is supposed to do. I'm not quite sure if it will just work when you tag a new release, or if you need to create your own token and I need to use that in the script.trakt repo.

razzeee commented 4 months ago

Thanks, glad it finally worked

razzeee commented 1 month ago

@rectifyer

I guess it still doesn't work?

https://github.com/trakt/script.trakt/actions/runs/9238071115/job/25415742582

razzeee commented 1 month ago

Looking at it again, it start to feel like GITHUB_TOKEN vs GH_TOKEN was done deliberately. And we shouldn't have changed it. Probably used to have a fixed user/token and not a changing one based on who releases.

We probably need to fork https://github.com/xbmc/repo-scripts/ with the trakt org for the script to work. https://github.com/trakt/script.trakt/actions/runs/9330076737/job/25683262621