Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 1
Message 1 of 2

GitHub App: teams.addOrUpdateRepo

 

I'm using the below code to add a Team to one of my Orginization's repository:

 

 

    try {
      const addTeam = await context.github.teams.addOrUpdateRepo({ owner: 'weirgroup', permission: "pull", repo: 'devops-docs', team_id: weirDevTeamId });
      if (addTeam.status === 204) {
        context.log.info(`Successfully added Weir Developers to ${context.payload.repository.name}`);
      } else {
        context.log.warn(`We experienced an issue adding Weir Developers to ${context.payload.repository.name}.\n\n${addTeam.headers}`);
      }
    } catch (error) {
      context.log.fatal(`Error ${error}`);
    }

 

I'm getting the following response:

23:49:46.063Z DEBUG github: GitHub request: PUT /teams/:team_id/repos/:owner/:repo - 422 undefined (installation=47431x)
  params: {
    "owner": "weirgroup",
    "permission": "pull",
    "repo": "devops-docs",
    "team_id": 2978570,
    "baseUrl": "https://api.github.com",
    "request": {
      "timeout": 0
    }
  }
23:49:46.063Z FATAL event: Error {"message":"Validation Failed","errors":[{"resource":"TeamRepository","code":"unprocessable","field":"data","message":"You must have administrative rights on this repository."}],"documentation_url":"https://developer.github.com/v3/teams/#add-or-update-team-repository"}

 

Other calls are successful within my Orginization -- My GitHub App has literally every permission set to Write or Admin. Can someone help point me in the right direction please?

1 Reply
Community Manager
Message 2 of 2

Re: GitHub App: teams.addOrUpdateRepo

Hi @intolerance,

 

Thanks for being here! If you haven't already, please contact us at git.io/c with the info so we can look into that further.

 

Best,

Andrea

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!