ConnectCloud Developers

Render the ownerships as a CODEOWNERS file (tenant:forge:read)

GET /api/forge/v1/projects/{key}/codeowners

Module: Forge · operationId: getForgeCodeowners · Tag: Configuration · Auth: access token (Authorization: Bearer <accessToken>)

Requires tenant:forge:read and a project the caller sees. The ownerships in precedence order, one line per path pattern with the logins of the effective owner (a team: its members) and deputies who linked an account at the provider of the project's default repository (scm; .github/CODEOWNERS for GitHub, .gitlab/CODEOWNERS for GitLab, GitHub without a repository); the others are named in a comment and in unlinked. An ownership without any linked owner keeps its lines without owners, so it still overrides earlier ones as in forge. Item types and labels have no CODEOWNERS form and are not written. ownerships summarises them like scm's answer (paths = number of path patterns). Nothing is written to the provider. 503 unavailable when scm cannot be asked.

Parameters

Name In Type Required Description
key path string yes Project key (e.g. APP)

Responses

  • 200 The file (application/json)
  • 404 Error (application/json)
  • 503 Error (application/json)

Fields of the 200 answer:

  • content (string, required): The CODEOWNERS file as text (nothing is written to GitHub)
  • ownerships (array of OwnershipSummary, required): Every ownership with its effective owner and path pattern count
    • deputies (array of string, required): E-mails of the deputies
    • key (string, required): Ownership key
    • name (string, required): Ownership name
    • paths (integer, required): How many of the asked paths the ownership owns (in the CODEOWNERS answer: its path patterns)
    • primary (string, required): E-mail of the effective owner, or the lead of the owning team
    • team (object): Set when the effective owner is a team
      • key (string, required): Team key
      • members (array of string, required): E-mails, the lead first
      • name (string, required): Team name
  • ownershipsConfigured (boolean, required): The project has at least one ownership
  • path (string, required): Where GitHub reads it: .github/CODEOWNERS
  • unlinked (array of string, required): Owners and deputies without a linked GitHub account

Example 200 answer:

{
  "content": "# Generated by ConnectCloud forge (project APP). Edit the ownerships in forge, not this file.\n\n# Apps (apps)\napp/** @paul-schmid-mi @marie-wagner-mi\n\n# Android-App (android)\napp/android/** @marie-wagner-mi @paul-schmid-mi\n\n# API-Client (api-client)\n# no GitHub login linked: emma.maier@muster-it.example\napp/shared/api/** @marie-wagner-mi\napp/shared/auth/** @marie-wagner-mi\n",
  "ownerships": [
    {
      "deputies": [],
      "key": "apps",
      "name": "Apps",
      "paths": 1,
      "primary": "paul.schmid@muster-it.example",
      "team": {
        "key": "mobile",
        "members": [
          "paul.schmid@muster-it.example",
          "marie.wagner@muster-it.example"
        ],
        "name": "Mobile-Team"
      }
    },
    {
      "deputies": [
        "paul.schmid@muster-it.example"
      ],
      "key": "qualitaet",
      "name": "Qualitätssicherung",
      "paths": 0,
      "primary": "emma.maier@muster-it.example"
    },
    {
      "deputies": [
        "paul.schmid@muster-it.example"
      ],
      "key": "android",
      "name": "Android-App",
      "paths": 1,
      "primary": "marie.wagner@muster-it.example"
    },
    {
      "deputies": [
        "marie.wagner@muster-it.example"
      ],
      "key": "api-client",
      "name": "API-Client",
      "paths": 2,
      "primary": "emma.maier@muster-it.example"
    }
  ],
  "ownershipsConfigured": true,
  "path": ".github/CODEOWNERS",
  "unlinked": [
    "emma.maier@muster-it.example"
  ]
}

Example request

curl -X GET 'https://api.mbcom.cloud/api/forge/v1/projects/string/codeowners' \
  -H "Authorization: Bearer $ACCESS_TOKEN"

View as Markdown · Interactive reference · OpenAPI