multi-gitter icon indicating copy to clipboard operation
multi-gitter copied to clipboard

multi-gitter unable to run against returned repos when using github app installation token

Open ghost opened this issue 2 years ago • 16 comments

Describe the bug When using a github app installation token with multi-gitter, all repos can be listed, but multi-gitter doesn't run against them. Using the same token, I am able to create pull requests using curl. The issue appears to be specific to multi-gitter, I wonder if parsing the repositories is the problem?

response with multi-gitter { 2022-01-27T07:00:15.0920886Z "host": "api.github.com", 2022-01-27T07:00:15.0921276Z "level": "trace", 2022-01-27T07:00:15.0921608Z "msg": "http request", 2022-01-27T07:00:15.0923119Z "request": "GET /orgs/xxxx/repos?page=1\u0026per_page=100 HTTP/1.1\r\nHost: api.github.com\r\nUser-Agent: go-github\r\nAccept: application/vnd.github.mercy-preview+json, application/vnd.github.nebula-preview+json\r\nAuthorization: Basic \u003cCENSORED\u003e\nAccept-Encoding: gzip\r\n\r\n", 2022-01-27T07:00:15.2640493Z "response": "HTTP/2.0 200 OK\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset\r\nCache-Control: private, max-age=60, s-maxage=60\r\nContent-Security-Policy: default-src 'none'\r\nContent-Type: application/json; charset=utf-8\r\nDate: Thu, 27 Jan 2022 07:00:15 GMT\r\nEtag: W/\"122717a36610aa3b6881db1871bc5285493eea207663614e64af2d6e83c4dfa8\"\r\nLink: \u003chttps://api.github.com/organizations/1874256/repos?page=2\u0026per_page=100\u003e; rel=\"next\", \u003chttps://api.github.com/organizations/1874256/repos?page=5\u0026per_page=100\u003e; rel=\"last\"\r\nReferrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin\r\nServer: GitHub.com\r\nStrict-Transport-Security: max-age=31536000; includeSubdomains; preload\r\nVary: Accept, Authorization, Cookie, X-GitHub-OTP\r\nVary: Accept-Encoding, Accept, X-Requested-With\r\nX-Content-Type-Options: nosniff\r\nX-Frame-Options: deny\r\nX-Github-Media-Type: github.mercy-preview; param=nebula-preview; format=json\r\nX-Github-Request-Id: 0740:7B0E:5B2CF6:C2FED9:61F242FD\r\nX-Ratelimit-Limit: 15000\r\nX-Ratelimit-Remaining: 14914\r\nX-Ratelimit-Reset: 1643267605\r\nX-Ratelimit-Resource: core\r\nX-Ratelimit-Used: 86\r\nX-Xss-Protection: 0\r\n\r\n[{\"id\":4307171,\"node_id\":\"MDEwOlJlcG9zaXRvcnk0MzA3MTcx\",\"name\":\"repo-xxxx\",\"full_name\":\"xxxx/repo-xxxx\",\"private\":false,\"owner\":{\"login\":\"xxxx\",\"id\":1874256,\"node_id\":\"MDEyOk9yZ2FuaXphdGlvbjE4NzQyNTY=\",\"avatar_url\":\"https://avatars.githubusercontent.com/u/1874256?v=4\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/xxxx\",\"html_url\":\"https://github.com/xxxx\",\"followers_url\":\"https://api.github.com/users/xxxx/followers\",\"following_url\":\"https://api.github.com/users/xxxx/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/xxxx/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/xxxx/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/xxxx/subscriptions\",\"organizations_url\":\"https://api.github.com/users/xxxx/orgs\",\"repos_url\":\"https://api.github.com/users/xxxx/repos\",\"events_url\":\"https://api.github.com/users/xxxx/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/xxxx/received_events\",\"type\":\"Organization\",\"site_admin\":false},\"html_url\":\"https://github.com/xxxx/repo-xxxx\",\"description\":\"xxxx\",\"fork\":false,\"url\":\"https://api.github.com/repos/xxxx/repo-xxxx\",\"forks_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/forks\",\"keys_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/keys{/key_id}\",\"collaborators_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/collaborators{/collaborator}\",\"teams_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/teams\",\"hooks_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/hooks\",\"issue_events_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/issues/events{/number}\",\"events_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/events\",\"assignees_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/assignees{/user}\",\"branches_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/branches{/branch}\",\"tags_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/tags\",\"blobs_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/git/blobs{/sha}\",\"git_tags_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/git/tags{/sha}\",\"git_refs_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/git/refs{/sha}\",\"trees_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/git/trees{/sha}\",\"statuses_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/statuses/{sha}\",\"languages_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/languages\",\"stargazers_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/stargazers\",\"contributors_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/contributors\",\"subscribers_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/subscribers\",\"subscription_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/subscription\",\"commits_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/commits{/sha}\",\"git_commits_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/git/commits{/sha}\",\"comments_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/comments{/number}\",\"issue_comment_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/issues/comments{/number}\",\"contents_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/contents/{+path}\",\"compare_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/compare/{base}...{head}\",\"merges_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/merges\",\"archive_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/{archive_format}{/ref}\",\"downloads_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/downloads\",\"issues_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/issues{/number}\",\"pulls_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/pulls{/number}\",\"milestones_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/milestones{/number}\",\"notifications_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/notifications{?since,all,participating}\",\"labels_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/labels{/name}\",\"releases_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/releases{/id}\",\"deployments_url\":\"https://api.github.com/repos/xxxx/repo-xxxx/deployments\",\"created_at\":\"2012-05-12T14:47:15Z\",\"updated_at\":\"2021-06-14T02:46:19Z\",\"pushed_at\":\"2021-12-12T11:43:20Z\",\"git_url\":\"git://github.com/xxxx/repo-xxxx.git\",\"ssh_url\":\"[email protected]:xxxx/repo-xxxx.git\",\"clone_url\":\"https://github.com/xxxx/repo-xxxx.git\",\"svn_url\":\"https://github.com/xxxx/repo-xxxx\",\"homepage\":null,\"size\":147,\"stargazers_count\":85,\"watchers_count\":85,\"language\":\"Ruby\",\"has_issues\":true,\"has_projects\":true,\"has_downloads\":true,\"has_wiki\":false,\"has_pages\":false,\"forks_count\":68,\"mirror_url\":null,\"archived\":false,\"disabled\":false,\"open_issues_count\":6,\"license\":null,\"allow_forking\":true,\"is_template\":false,\"topics\":[],\"visibility\":\"public\",\"forks\":68,\"open_issues\":6,\"watchers\":85,\"default_branch\":\"master\",\"permissions\":{\"admin\":false,\"maintain\":false,\"push\":false,\"triage\":false,\"pull\":false}}, 2022-01-27T15:49:36.0650855Z { 2022-01-27T15:49:36.0651395Z "level": "info", 2022-01-27T15:49:36.0652074Z "msg": "Running on 0 repositories", 2022-01-27T15:49:36.0653241Z "time": "2022-01-27T15:49:36Z" 2022-01-27T15:49:36.0660835Z }

Running a curl command with the exact same token given to multi-gitter works successfully

Run curl -u :*** -d '{"title":"testPR","base":"main", "head":"test-pr"}' https://api.github.com/repos/xxxx/xxxx/pulls

{
    "url": "https://api.github.com/repos/xxxx/xxxx/pulls/119",
    "id": 833163921,
    "node_id": "PR_kwDOF-zsSs4xqRKR",
    "html_url": "https://github.com/xxxx/xxxx/pull/119",
    "diff_url": "https://github.com/xxxx/xxxx/pull/119.diff",
    "patch_url": "https://github.com/xxxx/xxxx/pull/119.patch",
    "issue_url": "https://api.github.com/repos/xxxx/xxxx/issues/119",
    "number": 119,
    "state": "open",
    "locked": false,
    "title": "testPR",
    "user": {
      "login": "xxxx[bot]",
      "id": 93331094,
      "node_id": "BOT_kgDOBZAelg",
      "avatar_url": "https://avatars.githubusercontent.com/u/1874256?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/xxxx%5Bbot%5D",
      "html_url": "https://github.com/apps/xxxx",
      "followers_url": "https://api.github.com/users/xxxx%5Bbot%5D/followers",
      "following_url": "https://api.github.com/users/xxxx%5Bbot%5D/following{/other_user}",
      "gists_url": "https://api.github.com/users/xxxx%5Bbot%5D/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/xxxx%5Bbot%5D/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/xxxx%5Bbot%5D/subscriptions",
      "organizations_url": "https://api.github.com/users/xxxx%5Bbot%5D/orgs",
      "repos_url": "https://api.github.com/users/xxxx%5Bbot%5D/repos",
      "events_url": "https://api.github.com/users/xxxx%5Bbot%5D/events{/privacy}",
      "received_events_url": "https://api.github.com/users/xxxx%5Bbot%5D/received_events",
      "type": "Bot",
      "site_admin": false
    },
    "body": null,
    "created_at": "2022-01-27T08:29:13Z",
    "updated_at": "2022-01-27T08:29:13Z",
    "closed_at": null,
    "merged_at": null,
    "merge_commit_sha": null,
    "assignee": null,
    "assignees": [
  
    ],
    "requested_reviewers": [
  
    ],
    "requested_teams": [
      {
        "name": "xxxx",
        "id": 5003304,
        "node_id": "T_kwDOAByZUM4ATFgo",
        "slug": "xxxx",
        "description": "",
        "privacy": "closed",
        "url": "https://api.github.com/organizations/1874256/team/5003304",
        "html_url": "https://github.com/orgs/xxxx/teams/xxxx",
        "members_url": "https://api.github.com/organizations/1874256/team/5003304/members{/member}",
        "repositories_url": "https://api.github.com/organizations/1874256/team/5003304/repos",
        "permission": "pull",
        "parent": null
      }
    ],
    "labels": [
  
    ],
    "milestone": null,
    "draft": false,
    "commits_url": "https://api.github.com/repos/xxxx/xxxx/pulls/119/commits",
    "review_comments_url": "https://api.github.com/repos/xxxx/xxxx/pulls/119/comments",
    "review_comment_url": "https://api.github.com/repos/xxxx/xxxx/pulls/comments{/number}",
    "comments_url": "https://api.github.com/repos/xxxx/xxxx/issues/119/comments",
    "statuses_url": "https://api.github.com/repos/xxxx/xxxx/statuses/0b850dbb4f98bd4f6f68d2f595f8fe15752a72c0",
    "head": {
      "label": "xxxx:xxxx",
      "ref": "xxxx",
      "sha": "0b850dbb4f98bd4f6f68d2f595f8fe15752a72c0",
      "user": {
        "login": "xxxx",
        "id": 1874256,
        "node_id": "MDEyOk9yZ2FuaXphdGlvbjE4NzQyNTY=",
        "avatar_url": "https://avatars.githubusercontent.com/u/1874256?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/xxxx",
        "html_url": "https://github.com/xxxx",
        "followers_url": "https://api.github.com/users/xxxx/followers",
        "following_url": "https://api.github.com/users/xxxx/following{/other_user}",
        "gists_url": "https://api.github.com/users/xxxx/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/xxxx/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/xxxx/subscriptions",
        "organizations_url": "https://api.github.com/users/xxxx/orgs",
        "repos_url": "https://api.github.com/users/xxxx/repos",
        "events_url": "https://api.github.com/users/xxxx/events{/privacy}",
        "received_events_url": "https://api.github.com/users/xxxx/received_events",
        "type": "Organization",
        "site_admin": false
      },
      "repo": {
        "id": 401402954,
        "node_id": "MDEwOlJlcG9zaXRvcnk0MDE0MDI5NTQ=",
        "name": "xxxx",
        "full_name": "xxxx/xxxx",
        "private": true,
        "owner": {
          "login": "xxxx",
          "id": 1874256,
          "node_id": "MDEyOk9yZ2FuaXphdGlvbjE4NzQyNTY=",
          "avatar_url": "https://avatars.githubusercontent.com/u/1874256?v=4",
          "gravatar_id": "",
          "url": "https://api.github.com/users/xxxx",
          "html_url": "https://github.com/xxxx",
          "followers_url": "https://api.github.com/users/xxxx/followers",
          "following_url": "https://api.github.com/users/xxxx/following{/other_user}",
          "gists_url": "https://api.github.com/users/xxxx/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/xxxx/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/xxxx/subscriptions",
          "organizations_url": "https://api.github.com/users/xxxx/orgs",
          "repos_url": "https://api.github.com/users/xxxx/repos",
          "events_url": "https://api.github.com/users/xxxx/events{/privacy}",
          "received_events_url": "https://api.github.com/users/xxxx/received_events",
          "type": "Organization",
          "site_admin": false
        },
        "html_url": "https://github.com/xxxx/xxxx",
        "description": "xxxx",
        "fork": false,
        "url": "https://api.github.com/repos/xxxx/xxxx",
        "forks_url": "https://api.github.com/repos/xxxx/xxxx/forks",
        "keys_url": "https://api.github.com/repos/xxxx/xxxx/keys{/key_id}",
        "collaborators_url": "https://api.github.com/repos/xxxx/xxxx/collaborators{/collaborator}",
        "teams_url": "https://api.github.com/repos/xxxx/xxxx/teams",
        "hooks_url": "https://api.github.com/repos/xxxx/xxxx/hooks",
        "issue_events_url": "https://api.github.com/repos/xxxx/xxxx/issues/events{/number}",
        "events_url": "https://api.github.com/repos/xxxx/xxxx/events",
        "assignees_url": "https://api.github.com/repos/xxxx/xxxx/assignees{/user}",
        "branches_url": "https://api.github.com/repos/xxxx/xxxx/branches{/branch}",
        "tags_url": "https://api.github.com/repos/xxxx/xxxx/tags",
        "blobs_url": "https://api.github.com/repos/xxxx/xxxx/git/blobs{/sha}",
        "git_tags_url": "https://api.github.com/repos/xxxx/xxxx/git/tags{/sha}",
        "git_refs_url": "https://api.github.com/repos/xxxx/xxxx/git/refs{/sha}",
        "trees_url": "https://api.github.com/repos/xxxx/xxxx/git/trees{/sha}",
        "statuses_url": "https://api.github.com/repos/xxxx/xxxx/statuses/{sha}",
        "languages_url": "https://api.github.com/repos/xxxx/xxxx/languages",
        "stargazers_url": "https://api.github.com/repos/xxxx/xxxx/stargazers",
        "contributors_url": "https://api.github.com/repos/xxxx/xxxx/contributors",
        "subscribers_url": "https://api.github.com/repos/xxxx/xxxx/subscribers",
        "subscription_url": "https://api.github.com/repos/xxxx/xxxx/subscription",
        "commits_url": "https://api.github.com/repos/xxxx/xxxx/commits{/sha}",
        "git_commits_url": "https://api.github.com/repos/xxxx/xxxx/git/commits{/sha}",
        "comments_url": "https://api.github.com/repos/xxxx/xxxx/comments{/number}",
        "issue_comment_url": "https://api.github.com/repos/xxxx/xxxx/issues/comments{/number}",
        "contents_url": "https://api.github.com/repos/xxxx/xxxx/contents/{+path}",
        "compare_url": "https://api.github.com/repos/xxxx/xxxx/compare/{base}...{head}",
        "merges_url": "https://api.github.com/repos/xxxx/xxxx/merges",
        "archive_url": "https://api.github.com/repos/xxxx/xxxx/{archive_format}{/ref}",
        "downloads_url": "https://api.github.com/repos/xxxx/xxxx/downloads",
        "issues_url": "https://api.github.com/repos/xxxx/xxxx/issues{/number}",
        "pulls_url": "https://api.github.com/repos/xxxx/xxxx/pulls{/number}",
        "milestones_url": "https://api.github.com/repos/xxxx/xxxx/milestones{/number}",
        "notifications_url": "https://api.github.com/repos/xxxx/xxxx/notifications{?since,all,participating}",
        "labels_url": "https://api.github.com/repos/xxxx/xxxx/labels{/name}",
        "releases_url": "https://api.github.com/repos/xxxx/xxxx/releases{/id}",
        "deployments_url": "https://api.github.com/repos/xxxx/xxxx/deployments",
        "created_at": "2021-08-30T15:58:05Z",
        "updated_at": "2022-01-06T21:20:03Z",
        "pushed_at": "2022-01-27T08:28:16Z",
        "git_url": "git://github.com/xxxx/xxxx.git",
        "ssh_url": "[email protected]:xxxx/xxxx.git",
        "clone_url": "https://github.com/xxxx/xxxx.git",
        "svn_url": "https://github.com/xxxx/xxxx",
        "homepage": "",
        "size": 37501,
        "stargazers_count": 0,
        "watchers_count": 0,
        "language": "Python",
        "has_issues": false,
        "has_projects": false,
        "has_downloads": false,
        "has_wiki": false,
        "has_pages": false,
        "forks_count": 0,
        "mirror_url": null,
        "archived": false,
        "disabled": false,
        "open_issues_count": 4,
        "license": null,
        "allow_forking": true,
        "is_template": false,
        "topics": [
  
        ],
        "visibility": "internal",
        "forks": 0,
        "open_issues": 4,
        "watchers": 0,
        "default_branch": "main"
      }
    },
    "base": {
      "label": "xxxx:main",
      "ref": "main",
      "sha": "f38a4b8bb8a1ee8a72e045fb94f73ca009b5bff7",
      "user": {
        "login": "xxxx",
        "id": 1874256,
        "node_id": "MDEyOk9yZ2FuaXphdGlvbjE4NzQyNTY=",
        "avatar_url": "https://avatars.githubusercontent.com/u/1874256?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/xxxx",
        "html_url": "https://github.com/xxxx",
        "followers_url": "https://api.github.com/users/xxxx/followers",
        "following_url": "https://api.github.com/users/xxxx/following{/other_user}",
        "gists_url": "https://api.github.com/users/xxxx/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/xxxx/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/xxxx/subscriptions",
        "organizations_url": "https://api.github.com/users/xxxx/orgs",
        "repos_url": "https://api.github.com/users/xxxx/repos",
        "events_url": "https://api.github.com/users/xxxx/events{/privacy}",
        "received_events_url": "https://api.github.com/users/xxxx/received_events",
        "type": "Organization",
        "site_admin": false
      },
      "repo": {
        "id": 401402954,
        "node_id": "MDEwOlJlcG9zaXRvcnk0MDE0MDI5NTQ=",
        "name": "xxxx",
        "full_name": "xxxx/xxxx",
        "private": true,
        "owner": {
          "login": "xxxx",
          "id": 1874256,
          "node_id": "MDEyOk9yZ2FuaXphdGlvbjE4NzQyNTY=",
          "avatar_url": "https://avatars.githubusercontent.com/u/1874256?v=4",
          "gravatar_id": "",
          "url": "https://api.github.com/users/xxxx",
          "html_url": "https://github.com/xxxx",
          "followers_url": "https://api.github.com/users/xxxx/followers",
          "following_url": "https://api.github.com/users/xxxx/following{/other_user}",
          "gists_url": "https://api.github.com/users/xxxx/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/xxxx/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/xxxx/subscriptions",
          "organizations_url": "https://api.github.com/users/xxxx/orgs",
          "repos_url": "https://api.github.com/users/xxxx/repos",
          "events_url": "https://api.github.com/users/xxxx/events{/privacy}",
          "received_events_url": "https://api.github.com/users/xxxx/received_events",
          "type": "Organization",
          "site_admin": false
        },
        "html_url": "https://github.com/xxxx/xxxx",
        "description": "xxxx",
        "fork": false,
        "url": "https://api.github.com/repos/xxxx/xxxx",
        "forks_url": "https://api.github.com/repos/xxxx/xxxx/forks",
        "keys_url": "https://api.github.com/repos/xxxx/xxxx/keys{/key_id}",
        "collaborators_url": "https://api.github.com/repos/xxxx/xxxx/collaborators{/collaborator}",
        "teams_url": "https://api.github.com/repos/xxxx/xxxx/teams",
        "hooks_url": "https://api.github.com/repos/xxxx/xxxx/hooks",
        "issue_events_url": "https://api.github.com/repos/xxxx/xxxx/issues/events{/number}",
        "events_url": "https://api.github.com/repos/xxxx/xxxx/events",
        "assignees_url": "https://api.github.com/repos/xxxx/xxxx/assignees{/user}",
        "branches_url": "https://api.github.com/repos/xxxx/xxxx/branches{/branch}",
        "tags_url": "https://api.github.com/repos/xxxx/xxxx/tags",
        "blobs_url": "https://api.github.com/repos/xxxx/xxxx/git/blobs{/sha}",
        "git_tags_url": "https://api.github.com/repos/xxxx/xxxx/git/tags{/sha}",
        "git_refs_url": "https://api.github.com/repos/xxxx/xxxx/git/refs{/sha}",
        "trees_url": "https://api.github.com/repos/xxxx/xxxx/git/trees{/sha}",
        "statuses_url": "https://api.github.com/repos/xxxx/xxxx/statuses/{sha}",
        "languages_url": "https://api.github.com/repos/xxxx/xxxx/languages",
        "stargazers_url": "https://api.github.com/repos/xxxx/xxxx/stargazers",
        "contributors_url": "https://api.github.com/repos/xxxx/xxxx/contributors",
        "subscribers_url": "https://api.github.com/repos/xxxx/xxxx/subscribers",
        "subscription_url": "https://api.github.com/repos/xxxx/xxxx/subscription",
        "commits_url": "https://api.github.com/repos/xxxx/xxxx/commits{/sha}",
        "git_commits_url": "https://api.github.com/repos/xxxx/xxxx/git/commits{/sha}",
        "comments_url": "https://api.github.com/repos/xxxx/xxxx/comments{/number}",
        "issue_comment_url": "https://api.github.com/repos/xxxx/xxxx/issues/comments{/number}",
        "contents_url": "https://api.github.com/repos/xxxx/xxxx/contents/{+path}",
        "compare_url": "https://api.github.com/repos/xxxx/xxxx/compare/{base}...{head}",
        "merges_url": "https://api.github.com/repos/xxxx/xxxx/merges",
        "archive_url": "https://api.github.com/repos/xxxx/xxxx/{archive_format}{/ref}",
        "downloads_url": "https://api.github.com/repos/xxxx/xxxx/downloads",
        "issues_url": "https://api.github.com/repos/xxxx/xxxx/issues{/number}",
        "pulls_url": "https://api.github.com/repos/xxxx/xxxx/pulls{/number}",
        "milestones_url": "https://api.github.com/repos/xxxx/xxxx/milestones{/number}",
        "notifications_url": "https://api.github.com/repos/xxxx/xxxx/notifications{?since,all,participating}",
        "labels_url": "https://api.github.com/repos/xxxx/xxxx/labels{/name}",
        "releases_url": "https://api.github.com/repos/xxxx/xxxx/releases{/id}",
        "deployments_url": "https://api.github.com/repos/xxxx/xxxx/deployments",
        "created_at": "2021-08-30T15:58:05Z",
        "updated_at": "2022-01-06T21:20:03Z",
        "pushed_at": "2022-01-27T08:28:16Z",
        "git_url": "git://github.com/xxxx/xxxx.git",
        "ssh_url": "[email protected]:xxxx/xxxx.git",
        "clone_url": "https://github.com/xxxx/xxxx.git",
        "svn_url": "https://github.com/xxxx/xxxx",
        "homepage": "",
        "size": 37501,
        "stargazers_count": 0,
        "watchers_count": 0,
        "language": "Python",
        "has_issues": false,
        "has_projects": false,
        "has_downloads": false,
        "has_wiki": false,
        "has_pages": false,
        "forks_count": 0,
        "mirror_url": null,
        "archived": false,
        "disabled": false,
        "open_issues_count": 4,
        "license": null,
        "allow_forking": true,
        "is_template": false,
        "topics": [
  
        ],
        "visibility": "internal",
        "forks": 0,
        "open_issues": 4,
        "watchers": 0,
        "default_branch": "main"
      }
    },
    "_links": {
      "self": {
        "href": "https://api.github.com/repos/xxxx/xxxx/pulls/119"
      },
      "html": {
        "href": "https://github.com/xxxx/xxxx/pull/119"
      },
      "issue": {
        "href": "https://api.github.com/repos/xxxx/xxxx/issues/119"
      },
      "comments": {
        "href": "https://api.github.com/repos/xxxx/xxxx/issues/119/comments"
      },
      "review_comments": {
        "href": "https://api.github.com/repos/xxxx/xxxx/pulls/119/comments"
      },
      "review_comment": {
        "href": "https://api.github.com/repos/xxxx/xxxx/pulls/comments{/number}"
      },
      "commits": {
        "href": "https://api.github.com/repos/xxxx/xxxx/pulls/119/commits"
      },
      "statuses": {
        "href": "https://api.github.com/repos/xxxx/xxxx/statuses/0b850dbb4f98bd4f6f68d2f595f8fe15752a72c0"
      }
    },
    "author_association": "NONE",
    "auto_merge": null,
    "active_lock_reason": null,
    "merged": false,
    "mergeable": null,
    "rebaseable": null,
    "mergeable_state": "unknown",
    "merged_by": null,
    "comments": 0,
    "review_comments": 0,
    "maintainer_can_modify": false,
    "commits": 1,
    "additions": 17,
    "deletions": 0,
    "changed_files": 1
  }

Expected behavior multi-gitter includes an option(or just accepts) to use a github app installation token and runs against repos it finds.

This is related to https://github.com/lindell/multi-gitter/issues/223

ghost avatar Jan 27 '22 16:01 ghost

As asked in #223: Please also report the result of GET https://api.github.com/organizations/1874256/repos?page=1&per_page=100 when running through curl. Please confirm that you are certain you are using the correct token when using multi-gitter.

It does seem unlikely that the API returns that the user has no permissions but then allow a creation of a PR.

lindell avatar Jan 28 '22 06:01 lindell

Hello @lindell I'm absolutely positive I'm using the correct token, I just triple checked 😄

Here's the output you requested: (I've removed the other 99 repos to make scrubbing information easier, but they were a mix of public/private repos, much like the below response)

HTTP/2 200 
server: GitHub.com
date: Fri, 28 Jan 2022 14:46:43 GMT
content-type: application/json; charset=utf-8
content-length: 568639
cache-control: private, max-age=60, s-maxage=60
vary: Accept, Authorization, Cookie, X-GitHub-OTP
etag: "bbec84738bc27673b4316bba4c6c1146eb666131d5eec04926a5446286c7bb0e"
x-github-media-type: github.v3; format=json
link: <https://api.github.com/organizations/1874256/repos?page=2&per_page=100>; rel="next", <https://api.github.com/organizations/1874256/repos?page=5&per_page=100>; rel="last"
x-ratelimit-limit: 15000
x-ratelimit-remaining: 14988
x-ratelimit-reset: 1643382945
x-ratelimit-used: 12
x-ratelimit-resource: core
access-control-expose-headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
access-control-allow-origin: *
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
content-security-policy: default-src 'none'
vary: Accept-Encoding, Accept, X-Requested-With
x-github-request-id: D729:1E7C:6B591:2D5BC7:61F401D2

[
  {
    "id": 4731699,
    "node_id": "MDEwOlJlcG9zaXRvcnk0NzMxNjk5",
    "name": "xxxx",
    "full_name": "xxxx/xxxx",
    "private": true,
    "owner": {
      "login": "xxxx",
      "id": 1874256,
      "node_id": "MDEyOk9yZ2FuaXphdGlvbjE4NzQyNTY=",
      "avatar_url": "https://avatars.githubusercontent.com/u/1874256?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/xxxx",
      "html_url": "https://github.com/xxxx",
      "followers_url": "https://api.github.com/users/xxxx/followers",
      "following_url": "https://api.github.com/users/xxxx/following{/other_user}",
      "gists_url": "https://api.github.com/users/xxxx/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/xxxx/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/xxxx/subscriptions",
      "organizations_url": "https://api.github.com/users/xxxx/orgs",
      "repos_url": "https://api.github.com/users/xxxx/repos",
      "events_url": "https://api.github.com/users/xxxx/events{/privacy}",
      "received_events_url": "https://api.github.com/users/xxxx/received_events",
      "type": "Organization",
      "site_admin": false
    },
    "html_url": "https://github.com/xxxx/xxxx",
    "description": "xxxx",
    "fork": false,
    "url": "https://api.github.com/repos/xxxx/xxxx",
    "forks_url": "https://api.github.com/repos/xxxx/xxxx/forks",
    "keys_url": "https://api.github.com/repos/xxxx/xxxx/keys{/key_id}",
    "collaborators_url": "https://api.github.com/repos/xxxx/xxxx/collaborators{/collaborator}",
    "teams_url": "https://api.github.com/repos/xxxx/xxxx/teams",
    "hooks_url": "https://api.github.com/repos/xxxx/xxxx/hooks",
    "issue_events_url": "https://api.github.com/repos/xxxx/xxxx/issues/events{/number}",
    "events_url": "https://api.github.com/repos/xxxx/xxxx/events",
    "assignees_url": "https://api.github.com/repos/xxxx/xxxx/assignees{/user}",
    "branches_url": "https://api.github.com/repos/xxxx/xxxx/branches{/branch}",
    "tags_url": "https://api.github.com/repos/xxxx/xxxx/tags",
    "blobs_url": "https://api.github.com/repos/xxxx/xxxx/git/blobs{/sha}",
    "git_tags_url": "https://api.github.com/repos/xxxx/xxxx/git/tags{/sha}",
    "git_refs_url": "https://api.github.com/repos/xxxx/xxxx/git/refs{/sha}",
    "trees_url": "https://api.github.com/repos/xxxx/xxxx/git/trees{/sha}",
    "statuses_url": "https://api.github.com/repos/xxxx/xxxx/statuses/{sha}",
    "languages_url": "https://api.github.com/repos/xxxx/xxxx/languages",
    "stargazers_url": "https://api.github.com/repos/xxxx/xxxx/stargazers",
    "contributors_url": "https://api.github.com/repos/xxxx/xxxx/contributors",
    "subscribers_url": "https://api.github.com/repos/xxxx/xxxx/subscribers",
    "subscription_url": "https://api.github.com/repos/xxxx/xxxx/subscription",
    "commits_url": "https://api.github.com/repos/xxxx/xxxx/commits{/sha}",
    "git_commits_url": "https://api.github.com/repos/xxxx/xxxx/git/commits{/sha}",
    "comments_url": "https://api.github.com/repos/xxxx/xxxx/comments{/number}",
    "issue_comment_url": "https://api.github.com/repos/xxxx/xxxx/issues/comments{/number}",
    "contents_url": "https://api.github.com/repos/xxxx/xxxx/contents/{+path}",
    "compare_url": "https://api.github.com/repos/xxxx/xxxx/compare/{base}...{head}",
    "merges_url": "https://api.github.com/repos/xxxx/xxxx/merges",
    "archive_url": "https://api.github.com/repos/xxxx/xxxx/{archive_format}{/ref}",
    "downloads_url": "https://api.github.com/repos/xxxx/xxxx/downloads",
    "issues_url": "https://api.github.com/repos/xxxx/xxxx/issues{/number}",
    "pulls_url": "https://api.github.com/repos/xxxx/xxxx/pulls{/number}",
    "milestones_url": "https://api.github.com/repos/xxxx/xxxx/milestones{/number}",
    "notifications_url": "https://api.github.com/repos/xxxx/xxxx/notifications{?since,all,participating}",
    "labels_url": "https://api.github.com/repos/xxxx/xxxx/labels{/name}",
    "releases_url": "https://api.github.com/repos/xxxx/xxxx/releases{/id}",
    "deployments_url": "https://api.github.com/repos/xxxx/xxxx/deployments",
    "created_at": "2012-06-20T21:29:10Z",
    "updated_at": "2022-01-19T15:35:41Z",
    "pushed_at": "2022-01-28T14:45:42Z",
    "git_url": "git://github.com/xxxx/xxxx.git",
    "ssh_url": "[email protected]:xxxx/xxxx.git",
    "clone_url": "https://github.com/xxxx/xxxx.git",
    "svn_url": "https://github.com/xxxx/xxxx",
    "homepage": "https://arcticwolf.com",
    "size": 1570333,
    "stargazers_count": 11,
    "watchers_count": 11,
    "language": "Python",
    "has_issues": true,
    "has_projects": true,
    "has_downloads": true,
    "has_wiki": true,
    "has_pages": false,
    "forks_count": 237,
    "mirror_url": null,
    "archived": false,
    "disabled": false,
    "open_issues_count": 183,
    "license": null,
    "allow_forking": true,
    "is_template": false,
    "topics": [

    ],
    "visibility": "private",
    "forks": 237,
    "open_issues": 183,
    "watchers": 11,
    "default_branch": "master",
    "permissions": {
      "admin": false,
      "maintain": false,
      "push": false,
      "triage": false,
      "pull": false
    }
  },
  

Here's a PR being opened with the same token

HTTP/2 201 
server: GitHub.com
date: Fri, 28 Jan 2022 15:02:44 GMT
content-type: application/json; charset=utf-8
content-length: 16909
cache-control: private, max-age=60, s-maxage=60
vary: Accept, Authorization, Cookie, X-GitHub-OTP
etag: "95484a74bb48e44e5ea2342abc15404295fd17206b65d6b25b6fc50f0a885298"
location: https://api.github.com/repos/xxxx/xxxx/pulls/41884
x-github-media-type: github.v3; format=json
x-ratelimit-limit: 15000
x-ratelimit-remaining: 14976
x-ratelimit-reset: 1643382945
x-ratelimit-used: 24
x-ratelimit-resource: core
access-control-expose-headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
access-control-allow-origin: *
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
content-security-policy: default-src 'none'
vary: Accept-Encoding, Accept, X-Requested-With
x-github-request-id: C9DC:5BF7:1DCBC4:4EA008:61F40593

{
  "url": "https://api.github.com/repos/xxxx/xxxx/pulls/41884",
  "id": 834535095,
  "node_id": "PR_kwDOAEgzM84xvf63",
  "html_url": "https://github.com/xxxx/xxxx/pull/41884",
  "diff_url": "https://github.com/xxxx/xxxx/pull/41884.diff",
  "patch_url": "https://github.com/xxxx/xxxx/pull/41884.patch",
  "issue_url": "https://api.github.com/repos/xxxx/xxxx/issues/41884",
  "number": 41884,
  "state": "open",
  "locked": false,
  "title": "testPR",
  "user": {
    "login": "xxxx",
    "id": 93331094,
    "node_id": "BOT_kgDOBZAelg",
    "avatar_url": "https://avatars.githubusercontent.com/u/1874256?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/xxxx-xxxx%5Bbot%5D",
    "html_url": "https://github.com/apps/xxxx-xxxx",
    "followers_url": "https://api.github.com/users/xxxx-xxxx%5Bbot%5D/followers",
    "following_url": "https://api.github.com/users/xxxx-xxxx%5Bbot%5D/following{/other_user}",
    "gists_url": "https://api.github.com/users/xxxx-xxxx%5Bbot%5D/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/xxxx-xxxx%5Bbot%5D/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/xxxx-xxxx%5Bbot%5D/subscriptions",
    "organizations_url": "https://api.github.com/users/xxxx-xxxx%5Bbot%5D/orgs",
    "repos_url": "https://api.github.com/users/xxxx-xxxx%5Bbot%5D/repos",
    "events_url": "https://api.github.com/users/xxxx-xxxx%5Bbot%5D/events{/privacy}",
    "received_events_url": "https://api.github.com/users/xxxx-xxxx%5Bbot%5D/received_events",
    "type": "Bot",
    "site_admin": false
  },
  "body": null,
  "created_at": "2022-01-28T15:02:43Z",
  "updated_at": "2022-01-28T15:02:43Z",
  "closed_at": null,
  "merged_at": null,
  "merge_commit_sha": null,
  "assignee": null,
  "assignees": [

  ],
  "requested_reviewers": [

  ],
  "requested_teams": [

  ],
  "labels": [

  ],
  "milestone": null,
  "draft": false,
  "commits_url": "https://api.github.com/repos/xxxx/xxxx/pulls/41884/commits",
  "review_comments_url": "https://api.github.com/repos/xxxx/xxxx/pulls/41884/comments",
  "review_comment_url": "https://api.github.com/repos/xxxx/xxxx/pulls/comments{/number}",
  "comments_url": "https://api.github.com/repos/xxxx/xxxx/issues/41884/comments",
  "statuses_url": "https://api.github.com/repos/xxxx/xxxx/statuses/adc9204017f9e6176fc8fa65159e2871e7b75dc1",
  "head": {
    "label": "xxxx:xxxx",
    "ref": "xxxx",
    "sha": "adc9204017f9e6176fc8fa65159e2871e7b75dc1",
    "user": {
      "login": "xxxx",
      "id": 1874256,
      "node_id": "MDEyOk9yZ2FuaXphdGlvbjE4NzQyNTY=",
      "avatar_url": "https://avatars.githubusercontent.com/u/1874256?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/xxxx",
      "html_url": "https://github.com/xxxx",
      "followers_url": "https://api.github.com/users/xxxx/followers",
      "following_url": "https://api.github.com/users/xxxx/following{/other_user}",
      "gists_url": "https://api.github.com/users/xxxx/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/xxxx/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/xxxx/subscriptions",
      "organizations_url": "https://api.github.com/users/xxxx/orgs",
      "repos_url": "https://api.github.com/users/xxxx/repos",
      "events_url": "https://api.github.com/users/xxxx/events{/privacy}",
      "received_events_url": "https://api.github.com/users/xxxx/received_events",
      "type": "Organization",
      "site_admin": false
    },
    "repo": {
      "id": 4731699,
      "node_id": "MDEwOlJlcG9zaXRvcnk0NzMxNjk5",
      "name": "xxxx",
      "full_name": "xxxx/xxxx",
      "private": true,
      "owner": {
        "login": "xxxx",
        "id": 1874256,
        "node_id": "MDEyOk9yZ2FuaXphdGlvbjE4NzQyNTY=",
        "avatar_url": "https://avatars.githubusercontent.com/u/1874256?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/xxxx",
        "html_url": "https://github.com/xxxx",
        "followers_url": "https://api.github.com/users/xxxx/followers",
        "following_url": "https://api.github.com/users/xxxx/following{/other_user}",
        "gists_url": "https://api.github.com/users/xxxx/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/xxxx/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/xxxx/subscriptions",
        "organizations_url": "https://api.github.com/users/xxxx/orgs",
        "repos_url": "https://api.github.com/users/xxxx/repos",
        "events_url": "https://api.github.com/users/xxxx/events{/privacy}",
        "received_events_url": "https://api.github.com/users/xxxx/received_events",
        "type": "Organization",
        "site_admin": false
      },
      "html_url": "https://github.com/xxxx/xxxx",
      "description": "xxxx",
      "fork": false,
      "url": "https://api.github.com/repos/xxxx/xxxx",
      "forks_url": "https://api.github.com/repos/xxxx/xxxx/forks",
      "keys_url": "https://api.github.com/repos/xxxx/xxxx/keys{/key_id}",
      "collaborators_url": "https://api.github.com/repos/xxxx/xxxx/collaborators{/collaborator}",
      "teams_url": "https://api.github.com/repos/xxxx/xxxx/teams",
      "hooks_url": "https://api.github.com/repos/xxxx/xxxx/hooks",
      "issue_events_url": "https://api.github.com/repos/xxxx/xxxx/issues/events{/number}",
      "events_url": "https://api.github.com/repos/xxxx/xxxx/events",
      "assignees_url": "https://api.github.com/repos/xxxx/xxxx/assignees{/user}",
      "branches_url": "https://api.github.com/repos/xxxx/xxxx/branches{/branch}",
      "tags_url": "https://api.github.com/repos/xxxx/xxxx/tags",
      "blobs_url": "https://api.github.com/repos/xxxx/xxxx/git/blobs{/sha}",
      "git_tags_url": "https://api.github.com/repos/xxxx/xxxx/git/tags{/sha}",
      "git_refs_url": "https://api.github.com/repos/xxxx/xxxx/git/refs{/sha}",
      "trees_url": "https://api.github.com/repos/xxxx/xxxx/git/trees{/sha}",
      "statuses_url": "https://api.github.com/repos/xxxx/xxxx/statuses/{sha}",
      "languages_url": "https://api.github.com/repos/xxxx/xxxx/languages",
      "stargazers_url": "https://api.github.com/repos/xxxx/xxxx/stargazers",
      "contributors_url": "https://api.github.com/repos/xxxx/xxxx/contributors",
      "subscribers_url": "https://api.github.com/repos/xxxx/xxxx/subscribers",
      "subscription_url": "https://api.github.com/repos/xxxx/xxxx/subscription",
      "commits_url": "https://api.github.com/repos/xxxx/xxxx/commits{/sha}",
      "git_commits_url": "https://api.github.com/repos/xxxx/xxxx/git/commits{/sha}",
      "comments_url": "https://api.github.com/repos/xxxx/xxxx/comments{/number}",
      "issue_comment_url": "https://api.github.com/repos/xxxx/xxxx/issues/comments{/number}",
      "contents_url": "https://api.github.com/repos/xxxx/xxxx/contents/{+path}",
      "compare_url": "https://api.github.com/repos/xxxx/xxxx/compare/{base}...{head}",
      "merges_url": "https://api.github.com/repos/xxxx/xxxx/merges",
      "archive_url": "https://api.github.com/repos/xxxx/xxxx/{archive_format}{/ref}",
      "downloads_url": "https://api.github.com/repos/xxxx/xxxx/downloads",
      "issues_url": "https://api.github.com/repos/xxxx/xxxx/issues{/number}",
      "pulls_url": "https://api.github.com/repos/xxxx/xxxx/pulls{/number}",
      "milestones_url": "https://api.github.com/repos/xxxx/xxxx/milestones{/number}",
      "notifications_url": "https://api.github.com/repos/xxxx/xxxx/notifications{?since,all,participating}",
      "labels_url": "https://api.github.com/repos/xxxx/xxxx/labels{/name}",
      "releases_url": "https://api.github.com/repos/xxxx/xxxx/releases{/id}",
      "deployments_url": "https://api.github.com/repos/xxxx/xxxx/deployments",
      "created_at": "2012-06-20T21:29:10Z",
      "updated_at": "2022-01-19T15:35:41Z",
      "pushed_at": "2022-01-28T15:02:29Z",
      "git_url": "git://github.com/xxxx/xxxx.git",
      "ssh_url": "[email protected]:xxxx/xxxx.git",
      "clone_url": "https://github.com/xxxx/xxxx.git",
      "svn_url": "https://github.com/xxxx/xxxx",
      "homepage": "https://arcticwolf.com",
      "size": 1570333,
      "stargazers_count": 11,
      "watchers_count": 11,
      "language": "Python",
      "has_issues": true,
      "has_projects": true,
      "has_downloads": true,
      "has_wiki": true,
      "has_pages": false,
      "forks_count": 237,
      "mirror_url": null,
      "archived": false,
      "disabled": false,
      "open_issues_count": 182,
      "license": null,
      "allow_forking": true,
      "is_template": false,
      "topics": [

      ],
      "visibility": "private",
      "forks": 237,
      "open_issues": 182,
      "watchers": 11,
      "default_branch": "master"
    }
  },
  "base": {
    "label": "xxxx:master",
    "ref": "master",
    "sha": "15887184e64ae244abe7cf540c38c8c62cd53410",
    "user": {
      "login": "xxxx",
      "id": 1874256,
      "node_id": "MDEyOk9yZ2FuaXphdGlvbjE4NzQyNTY=",
      "avatar_url": "https://avatars.githubusercontent.com/u/1874256?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/xxxx",
      "html_url": "https://github.com/xxxx",
      "followers_url": "https://api.github.com/users/xxxx/followers",
      "following_url": "https://api.github.com/users/xxxx/following{/other_user}",
      "gists_url": "https://api.github.com/users/xxxx/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/xxxx/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/xxxx/subscriptions",
      "organizations_url": "https://api.github.com/users/xxxx/orgs",
      "repos_url": "https://api.github.com/users/xxxx/repos",
      "events_url": "https://api.github.com/users/xxxx/events{/privacy}",
      "received_events_url": "https://api.github.com/users/xxxx/received_events",
      "type": "Organization",
      "site_admin": false
    },
    "repo": {
      "id": 4731699,
      "node_id": "MDEwOlJlcG9zaXRvcnk0NzMxNjk5",
      "name": "xxxx",
      "full_name": "xxxx/xxxx",
      "private": true,
      "owner": {
        "login": "xxxx",
        "id": 1874256,
        "node_id": "MDEyOk9yZ2FuaXphdGlvbjE4NzQyNTY=",
        "avatar_url": "https://avatars.githubusercontent.com/u/1874256?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/xxxx",
        "html_url": "https://github.com/xxxx",
        "followers_url": "https://api.github.com/users/xxxx/followers",
        "following_url": "https://api.github.com/users/xxxx/following{/other_user}",
        "gists_url": "https://api.github.com/users/xxxx/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/xxxx/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/xxxx/subscriptions",
        "organizations_url": "https://api.github.com/users/xxxx/orgs",
        "repos_url": "https://api.github.com/users/xxxx/repos",
        "events_url": "https://api.github.com/users/xxxx/events{/privacy}",
        "received_events_url": "https://api.github.com/users/xxxx/received_events",
        "type": "Organization",
        "site_admin": false
      },
      "html_url": "https://github.com/xxxx/xxxx",
      "description": "xxxx",
      "fork": false,
      "url": "https://api.github.com/repos/xxxx/xxxx",
      "forks_url": "https://api.github.com/repos/xxxx/xxxx/forks",
      "keys_url": "https://api.github.com/repos/xxxx/xxxx/keys{/key_id}",
      "collaborators_url": "https://api.github.com/repos/xxxx/xxxx/collaborators{/collaborator}",
      "teams_url": "https://api.github.com/repos/xxxx/xxxx/teams",
      "hooks_url": "https://api.github.com/repos/xxxx/xxxx/hooks",
      "issue_events_url": "https://api.github.com/repos/xxxx/xxxx/issues/events{/number}",
      "events_url": "https://api.github.com/repos/xxxx/xxxx/events",
      "assignees_url": "https://api.github.com/repos/xxxx/xxxx/assignees{/user}",
      "branches_url": "https://api.github.com/repos/xxxx/xxxx/branches{/branch}",
      "tags_url": "https://api.github.com/repos/xxxx/xxxx/tags",
      "blobs_url": "https://api.github.com/repos/xxxx/xxxx/git/blobs{/sha}",
      "git_tags_url": "https://api.github.com/repos/xxxx/xxxx/git/tags{/sha}",
      "git_refs_url": "https://api.github.com/repos/xxxx/xxxx/git/refs{/sha}",
      "trees_url": "https://api.github.com/repos/xxxx/xxxx/git/trees{/sha}",
      "statuses_url": "https://api.github.com/repos/xxxx/xxxx/statuses/{sha}",
      "languages_url": "https://api.github.com/repos/xxxx/xxxx/languages",
      "stargazers_url": "https://api.github.com/repos/xxxx/xxxx/stargazers",
      "contributors_url": "https://api.github.com/repos/xxxx/xxxx/contributors",
      "subscribers_url": "https://api.github.com/repos/xxxx/xxxx/subscribers",
      "subscription_url": "https://api.github.com/repos/xxxx/xxxx/subscription",
      "commits_url": "https://api.github.com/repos/xxxx/xxxx/commits{/sha}",
      "git_commits_url": "https://api.github.com/repos/xxxx/xxxx/git/commits{/sha}",
      "comments_url": "https://api.github.com/repos/xxxx/xxxx/comments{/number}",
      "issue_comment_url": "https://api.github.com/repos/xxxx/xxxx/issues/comments{/number}",
      "contents_url": "https://api.github.com/repos/xxxx/xxxx/contents/{+path}",
      "compare_url": "https://api.github.com/repos/xxxx/xxxx/compare/{base}...{head}",
      "merges_url": "https://api.github.com/repos/xxxx/xxxx/merges",
      "archive_url": "https://api.github.com/repos/xxxx/xxxx/{archive_format}{/ref}",
      "downloads_url": "https://api.github.com/repos/xxxx/xxxx/downloads",
      "issues_url": "https://api.github.com/repos/xxxx/xxxx/issues{/number}",
      "pulls_url": "https://api.github.com/repos/xxxx/xxxx/pulls{/number}",
      "milestones_url": "https://api.github.com/repos/xxxx/xxxx/milestones{/number}",
      "notifications_url": "https://api.github.com/repos/xxxx/xxxx/notifications{?since,all,participating}",
      "labels_url": "https://api.github.com/repos/xxxx/xxxx/labels{/name}",
      "releases_url": "https://api.github.com/repos/xxxx/xxxx/releases{/id}",
      "deployments_url": "https://api.github.com/repos/xxxx/xxxx/deployments",
      "created_at": "2012-06-20T21:29:10Z",
      "updated_at": "2022-01-19T15:35:41Z",
      "pushed_at": "2022-01-28T15:02:29Z",
      "git_url": "git://github.com/xxxx/xxxx.git",
      "ssh_url": "[email protected]:xxxx/xxxx.git",
      "clone_url": "https://github.com/xxxx/xxxx.git",
      "svn_url": "https://github.com/xxxx/xxxx",
      "homepage": "xxxx",
      "size": 1570333,
      "stargazers_count": 11,
      "watchers_count": 11,
      "language": "Python",
      "has_issues": true,
      "has_projects": true,
      "has_downloads": true,
      "has_wiki": true,
      "has_pages": false,
      "forks_count": 237,
      "mirror_url": null,
      "archived": false,
      "disabled": false,
      "open_issues_count": 182,
      "license": null,
      "allow_forking": true,
      "is_template": false,
      "topics": [

      ],
      "visibility": "private",
      "forks": 237,
      "open_issues": 182,
      "watchers": 11,
      "default_branch": "master"
    }
  },
  "_links": {
    "self": {
      "href": "https://api.github.com/repos/xxxx/xxxx/pulls/41884"
    },
    "html": {
      "href": "https://github.com/xxxx/xxxx/pull/41884"
    },
    "issue": {
      "href": "https://api.github.com/repos/xxxx/xxxx/issues/41884"
    },
    "comments": {
      "href": "https://api.github.com/repos/xxxx/xxxx/issues/41884/comments"
    },
    "review_comments": {
      "href": "https://api.github.com/repos/xxxx/xxxx/pulls/41884/comments"
    },
    "review_comment": {
      "href": "https://api.github.com/repos/xxxx/xxxx/pulls/comments{/number}"
    },
    "commits": {
      "href": "https://api.github.com/repos/xxxx/xxxx/pulls/41884/commits"
    },
    "statuses": {
      "href": "https://api.github.com/repos/xxxx/xxxx/statuses/adc9204017f9e6176fc8fa65159e2871e7b75dc1"
    }
  },
  "author_association": "NONE",
  "auto_merge": null,
  "active_lock_reason": null,
  "merged": false,
  "mergeable": null,
  "rebaseable": null,
  "mergeable_state": "unknown",
  "merged_by": null,
  "comments": 0,
  "review_comments": 0,
  "maintainer_can_modify": false,
  "commits": 1,
  "additions": 3930,
  "deletions": 54,
  "changed_files": 9
}

ghost avatar Jan 28 '22 15:01 ghost

This is good information. But the fetch does still say (which I must assume is right), that the token has neither pull nor push permissions to the repos. So it can create a pull request from an already created branch. But it cannot pull down the repo to run the script, or push the changes back to a branch. What permissions does the token have?

lindell avatar Jan 29 '22 08:01 lindell

Hi @lindell in those examples the token was essentially given write:* for testing purposes. I've been doing some reading, and in order for the installation access token to authenticate with a git client it needs to be able to access urls like so. Would this be a problem for multi-gitter? It would explain the discrepancy between the permissions I've given the token, but because the git client is unauthenticated it returns false.

If it is a problem, can we test adding support for this kind of authentication?

ghost avatar Feb 01 '22 02:02 ghost

@lindell I tested the token in a typical workflow, checking out a repo, creating a commit, pushing, opening a PR, etc and it worked successfully.

- name: checkout repo
  uses: actions/checkout@v2
  with:
    token: ${{ secrets.my-github-app-installation-token }}
    fetch-depth: 0

- name: Create new branch and commit
  run: |
    git config --global user.name "my-test-bot[bot]"
    git config --global user.email "xxxxx+my-test-bot[bot]@users.noreply.github.com"
    git checkout -b branch$GITHUB_RUN_NUMBER
    echo "some random text" > $GITHUB_RUN_NUMBER.txt
    git add .
    git commit -m "adding some commits"
    git push --set-upstream origin branch$GITHUB_RUN_NUMBER

- name: Create Pull Request with App token
  run: |
    curl -v -X POST -H   "Accept: application/vnd.github.v3+json" \
    -H "Authorization: token ${{ secrets.my-github-app-installation-token }}" \
    "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls" \
    -d '{"head":"'"branch$GITHUB_RUN_NUMBER"'","base":"main","title":"'"$GITHUB_RUN_NUMBER pr from app"'","body":"'"this is the $GITHUB_RUN_NUMBER body"'"}'```

ghost avatar Feb 01 '22 15:02 ghost

The authentication right now is done through https://<token>@ and not https://x-access-token:<token>@, might work with both, but otherwise, if that change would be needed we would ofc make it. But the problem is still that the API say that the token does not have access to do this (pulling or pushing). I still have a hard time believing that the GitHub API gives back the wrong information. Can you please make a step by step description of how you generated the token, including all permissions you've set? So that I can test your setup myself.

The example does unfortunately not show us anything. The commit and push is still made with the authentication of the github action an not the authentication of the token. We already confirmed that the creation of the PR is permitted, but that is not why multi-gitter choose to not run on the repo(s).

lindell avatar Feb 02 '22 06:02 lindell

I generated the token with this action, github support also used this:

- name: my-app-install token
  id: my-app
  uses: getsentry/action-github-app-token@v1
  with:
    app_id: ${{ secrets.APP_ID }}
    private_key: ${{ secrets.APP_PRIVATE_KEY }}

The output of the action to get the token is ${{ steps.my-app.outputs.token }} In terms of permissions, for testing I gave write permissions to every available option.

The GitHub App was installed on an org with access to all repositories following this guide https://docs.github.com/en/developers/apps/building-github-apps/creating-a-github-app

ghost avatar Feb 02 '22 14:02 ghost

@lindell I just wanted to check in and see if there's any updates on this issue.

I'm going to try switching the url to https://x-access-token: in a fork and see if that does the trick. I'll report back the results.

ghost avatar Feb 10 '22 13:02 ghost

@lindell I just wanted to check in and see if there's any updates on this issue.

I'm going to try switching the url to https://x-access-token: in a fork and see if that does the trick. I'll report back the results.

Hi @lindell just following up on the above, this didn't get multi-getter to run on any repos it found. I was however able to use the installation token to do a pull/push from my terminal with the git client. I tried switching the go library option to cmd to use the git client but it wasn't successful. Hopefully this help. I think being able to use GitHub Apps as a "bot" user to make changes across all repos in an org would really be an amazing feature for this tool.

ghost avatar Feb 11 '22 13:02 ghost

I was however able to use the installation token to do a pull/push from my terminal with the git client. How did you use this? Did you set the origin to https://x-access-token:?

lindell avatar Feb 15 '22 06:02 lindell

I tried it out (but outside of github actions) and get the same result as you. I can pull and push by using x-access-token: but the API returns that I will not be able to. I have not yet asked the GitHub team why this is/filed a bug for it.

Does this work for you? https://github.com/lindell/multi-gitter/tree/github-app-token

lindell avatar Mar 11 '22 08:03 lindell

Hi @lindell this does work for me.

ghost avatar Apr 19 '22 21:04 ghost

@lindell Any updated on getting this feature merged in?

ghost avatar Jun 02 '22 16:06 ghost

I still feel a bit uneasy about going against what the API tells us we are allowed to do. It could cause cases where we actually try to pull from repos we are not allowed to? Since we have to ignore the permissions checking altogether if it's used with the app token.

lindell avatar Jun 03 '22 05:06 lindell

Hmm I agree, is this something that a support ticket should be opened for? I would open one, however I may not be able to speak to multi-gitter's behaviour as well as you can 😄

ghost avatar Jun 07 '22 14:06 ghost

Please do open a support ticket with GitHub :) You can both refer to me if there are any questions around multi-gitter is using the API, and link to this issue as reference.

lindell avatar Jun 07 '22 19:06 lindell

Its seems that the creator of this bug has deleted their account, and since no one else has indicated this is needed, I'm closing this bug for now.

lindell avatar Nov 19 '22 20:11 lindell

@lindell I have this exact need: I'd like to be able to perform actions as a github app, rather than as my personal user in a private github organization. What is the process for getting this issue re-opened?

mspiegel31 avatar Feb 27 '23 20:02 mspiegel31

@mspiegel31 Please open an issue with GitHub stating the (assumed) bug.

That even if the token has pull and push permissions, the API will still return:

    "permissions": {
      "admin": false,
      "maintain": false,
      "push": false,
      "triage": false,
      "pull": false
    }

I have not yet reverified that this is still the case as of today, so please do that first.

lindell avatar Feb 28 '23 13:02 lindell

@lindell I've opened a ticket with github and referenced this issue. Please let me know if you'd like me to keep discussion going on this (closed) issue in multi-gitter, or if you'd like to direct the conversation somewhere else.

thanks for the great tool, and thanks for the support!

mspiegel31 avatar Feb 28 '23 14:02 mspiegel31

it's maybe worth mentioning that git-xargs (also written in go) seems to work fine with installation access tokens; I've spent my afternoon testing my usecase with this tool.

I'm not familiar with how multi-gitter or git-xargs is implemented, but that would seem to indicate it's not a bug on the github side?

mspiegel31 avatar Feb 28 '23 16:02 mspiegel31

@lindell We've been pursing this through the Github end through Enterprise Support and it sounds like, from Github's perspective, this end point is working as intended.

I have received word from our engineers regarding this case. After further investigation they have determined that the initial findings were incorrect that this is not a bug but that the API endpoint you are accessing is printing information as expected. To clarify, role and ability based permissions are only applicable to the user. Since this is a GitHub Application, the permissions that are printed are not applicable to the function of the GitHub App and we don't try to derive from the fine-grained permissions for the application.

Please let me know if you need additional information, since we've talking to Github about this for a few weeks now.

When authorizing through oauth now, I get the permissions through the API working as expected. Can you, @mspiegel31, please verify your steps, and what the API gives you back.

image

lindell avatar Mar 03 '23 11:03 lindell

@lindell We are still unable to use multi-gitter using specifically a GitHub App Token and we had contact with the GitHub engineers via our enterprise support stating that the APIs are behaving as expected as @chris-statham-arcticwolf mentioned here: https://github.com/lindell/multi-gitter/issues/224#issuecomment-1452170144

We asked this question to GitHub Support:

I have a couple followups

From what I've gathered, GitHub App Installation Access Tokens and Personal Access Tokens are (largely?) intended to be interchangeable when used for authorization in web requests to the API (assuming they have sufficient permission scope). This means that whatever is using them can be agnostic as to which is used.

For example, it doesn't matter if [TOKEN] in the following curl command is a GitHub App Installation Access Token or a Personal Access Token - if both have permission then they're both able to get a successful response.

curl -s -H "Authorization: token [TOKEN]" https://api.github.com/repos/{REDACTED}

But it sounds like if the permission part of the response is intended to only be filled out for PATs, then whatever is calling the GitHub APIs should know if it is using a Personal Access Token or a GitHub App Installation Access Token (or I guess these days a fine-grained Personal Access Token). So instead of just using the token provided, custom scripts/applications/etc then are intended to do something like (pseudocode)

if token.startswith('ghp_')

// call the routes for Personal Access Tokens

else if token.startswith('ghs_')

// call the routes for GitHub App Installation Access Tokens

else if token.startswith('github_pat_')

// call the routes for Fine Grained Personal Access Tokens

...

Is that a fair conclusion?

Secondly, do you know if the /repos/{owner}/{repo} route derives permissions for fine-grained Personal Access Tokens? Or is there a separate route determining access permissions for that as well?

Thanks,

Their response:

Thank you for reaching out. It largely depends on the endpoint you are using. GitHub App Tokens are considered server to server tokens in a sense that they can make requests on behalf of themselves without user input. Other tokens such as OAuth Tokens are required to be tied to a user account. Some endpoints do not allow for GitHub App Installation Tokens because they require . Fine-grained access tokens are still relatively new and do not work for all endpoints. Fine-grained personal access tokens are pretty much the same as Personal Access Tokens (PAT Classic) except that they have permissions that are scoped the same as GitHub Apps. As far as the pseudo code, the logic for accessing different endpoints can be a bit complex but essentially the prefix does identify the token. Obviously it's a bit more nuanced than that but it's a fair conclusion.

joel-mccoy-arcticwolf avatar Mar 22 '23 15:03 joel-mccoy-arcticwolf

I've just run in to this behaviour as well.

I'm trying to use a GitHub app's token to run the tool, and operations are skipped because the API response has the push and pull permissions as false as noted above, so nothing occurs.

However, the token works as intended if used directly to clone.

It would seem that in the case of GitHub app tokens, the assumptions made on the permissions by the tool are incorrect.

Here's some snippets from a GitHub Actions workflow that demonstrates things.

Getting a token for the app

Run peter-murray/workflow-application-token-action@v2
Found GitHub Application: {APP_NAME}
Obtaining application installation for organization: {ORG_NAME}
Requesting limitation on GitHub Application permissions to only: {"contents":"write","pull_requests":"write"}
{"token":"***","expires_at":"2023-03-24T09:53:[18](https://{GHES_HOST}/{ORG_NAME}/{REPO_NAME}/runs/1432614?check_suite_focus=true#step:5:19)Z","permissions":{"contents":"write","metadata":"read","pull_requests":"write"},"repository_selection":"all"}
Successfully generated an access token for application.

Cloning a repo with actions/checkout using that token

Run actions/checkout@v3
Syncing repository: {ORG_NAME}/{REPO_NAME}
Getting Git version info
Temporarily overriding HOME='/runner/_work/_temp/c8b79aeb-abb5-42af-b7f4-[52](https://{GHES_HOST}/{ORG_NAME}/{REPO_NAME}/runs/1432614?check_suite_focus=true#step:7:58)8428c13f39' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
/usr/bin/git config --global --add safe.directory /runner/_work/{ORG_NAME}/{REPO_NAME}/_repo
Initializing the repository
Disabling automatic garbage collection
Setting up auth
Determining the default branch
Fetching the repository
Determining the checkout info
Checking out the ref
/usr/bin/git log -1 --format='%H'
'{COMMIT_SHA}'

Getting the repo permissions with the token from the GitHub API using gh

Run gh api "/repos/{ORG_NAME}/{REPO_NAME}" --jq '.permissions'
{"admin":false,"maintain":false,"pull":false,"push":false,"triage":false}

Running multi-gitter with that token

Run multi-gitter \
time="2023-03-24T08:53:20Z" level=debug msg="Skipping repository since the token does not have pull permissions" repo={ORG_NAME}/{REPO_NAME}
time="2023-03-24T08:53:20Z" level=info msg="No repositories found. Please make sure the user of the token has the correct access to the repos you want to change."

martincostello avatar Mar 24 '23 09:03 martincostello

@joel-mccoy-arcticwolf Thanks for reaching out to GH support. Is still think this part is strange since it's returned for all token types.

But it sounds like if the permission part of the response is intended to only be filled out for PATs

But with the confirmation that this "works as intended", a fix in multi-gitter should be implemented. I will take a look when I have the time.

lindell avatar Mar 24 '23 11:03 lindell

Had some time to fix this now: #334, but I'm out of time for today, so I have not been able to test this yet.

If you are able to, please test these changes.

lindell avatar Mar 24 '23 12:03 lindell

Great, thanks! I'll test this out this afternoon.

martincostello avatar Mar 24 '23 12:03 martincostello

I've just installed the tool from your branch and it works as I would expect and the token for my GitHub app is now able to clone the repositories that it has write access to.

Thanks for the fast turnaround.

For reference, this is how I installed the version from the fix PR:

- name: Setup go
  uses: actions/setup-go@v3
  with:
    go-version: '^1.20.2'

- name: Install multi-gitter
  shell: bash
  run: go install github.com/lindell/multi-gitter@github-app-token-fix

martincostello avatar Mar 24 '23 16:03 martincostello

Included in release v0.44.2 🎉

github-actions[bot] avatar Mar 25 '23 08:03 github-actions[bot]