piceaTech / node-gitlab-2-github

Migrate Issues, milestones etc from gitlab to github
MIT License
547 stars 133 forks source link

Getting a 403 on write to github #180

Closed pedro-reform closed 1 year ago

pedro-reform commented 1 year ago

The destination repo belongs to an organisation, I created a PAT token on my account and assigned it to the ORG, and set the github as follows:

github: {
    baseUrl: 'https://github.com/myOrg',
    apiUrl: 'https://api.github.com',
    owner: 'myOrg',
    ownerIsOrg: true,
    token: 'myPATtoken',
    token_owner: 'myOrg',
    repo: 'my-repo',
    recreateRepo: false,
}

and am getting the following error:

 RequestError [HttpError]: Resource not accessible by personal access token
    at /mnt/f/Projects/node-gitlab-2-github/node_modules/@octokit/request/dist-src/fetch-wrapper.js:68:27
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Job.doExecute (/mnt/f/Projects/node-gitlab-2-github/node_modules/bottleneck/light.js:405:18) {
  status: 403,
  response: {
    url: 'https://api.github.com/repos/myOrg/my-repo/import/issues',
    status: 403,
pedro-reform commented 1 year ago

This was because of using the new fine grain tokens and having useIssueImportAPI set to true. Setting useIssueImportAPI to false worked