Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
| Parameter | Description | Example | Required |
| --------- | ----------- | ------- | -------- |
| `OCEAN__INTEGRATION__CONFIG__GITHUB_TOKEN` | A GitHub Personal Access Token (PAT) to authenticate with your GitHub Organization. Only required when you're not authenticating as a [Github app](./installation/github-app.mdx) | | ✅ |
| `OCEAN__INTEGRATION__CONFIG__GITHUB_TOKEN` | A GitHub Personal Access Token (PAT) to authenticate with your GitHub Organization. Use classic PAT for multi-org support (v3.0.0-beta+). Only required when you're not authenticating as a [Github app](./installation/github-app.mdx) | | ✅ |
| `OCEAN__INTEGRATION__CONFIG__GTIHUB_HOST` | The API endpoint for your GitHub instance. For GitHub Enterprise Cloud, this will be `https://<org_name.ghe.com>`. Defaults to `https://api.github.com` if not provided. | | ❌ |
| `OCEAN__INTEGRATION__CONFIG__GTIHUB_ORGANIZATION` | The name of your Github organization | | |
| `OCEAN__INTEGRATION__CONFIG__GITHUB_ORGANIZATION` | The name of your Github organization (for GitHub App or Fine-grained PAT authentication). Required for single-org authentication. | | |
| `OCEAN__PORT__CLIENT_ID` | Your Port client id([How to get the credentials](https://docs.port.io/build-your-software-catalog/custom-integration/api/#find-your-port-credentials)) | | ✅ |
| `OCEAN__PORT__CLIENT_SECRET` | Your Port client secret ([How to get the credentials](https://docs.port.io/build-your-software-catalog/custom-integration/api/#find-your-port-credentials)) | | ✅ |
| `OCEAN__PORT__BASE_URL` | Your Port API URL - `https://api.getport.io` for EU, `https://api.us.getport.io` for US | | ✅ |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- [`organization`](https://docs.github.com/en/rest/orgs/orgs?apiVersion=2022-11-28#list-organizations-for-the-authenticated-user)
- [`repository`](https://docs.github.com/en/rest/repos/repos#get-a-repository)
- [`pull-request`](https://docs.github.com/en/rest/pulls/pulls#get-a-pull-request)
- [`file`](/build-your-software-catalog/sync-data-to-catalog/git/github/#ingest-files-from-your-repositories)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ resources:
readme: file://README.md # fetching the README.md file that is within the root folder of the repository and ingesting its contents as a markdown property
url: .html_url
defaultBranch: .default_branch
relations:
organization: .__organization.login
- kind: pull-request
selector:
query: "true" # JQ boolean query. If evaluated to false - skip syncing the object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {}
"relations": {
"organization": {
"title": "Organization",
"target": "githubOrganization",
"required": false,
"many": false
}
}
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ resources:
query: 'true'
files:
- path: 'README.md'
organization: my-org # Optional if githubOrganization is set; required if not set
repos:
- name: test-repo
branch: main
port:
entity:
mappings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
query: 'true'
files:
- path: '**/package.json'
organization: my-org # Optional if githubOrganization is set; required if not set
repos:
- name: vscode
branch: main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ resources:
query: "true" # JQ boolean query. If evaluated to false - skip syncing the object.
folders: # Specify the repositories and folders to include under this relative path.
- path: apps/* # Relative path to the folders within the repositories.
organization: my-org # Optional if githubOrganization is set; required if not set
repos: # List of repositories to include folders from.
- name: backend-service
branch: main
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<details>
<summary><b>Organization blueprint (click to expand)</b></summary>

```json showLineNumbers
{
"identifier": "githubOrganization",
"description": "This blueprint represents a service in our software catalog",
"title": "Organization",
"icon": "Github",
"schema": {
"properties": {
"login": {
"type": "string",
"title": "Organization Login",
"description": "The GitHub organization login name"
},
"id": {
"type": "number",
"title": "Organization ID",
"description": "GitHub organization ID"
},
"nodeId": {
"type": "string",
"title": "Node ID",
"description": "GitHub GraphQL node ID"
},
"url": {
"type": "string",
"title": "API URL",
"description": "GitHub API URL for the organization"
},
"reposUrl": {
"type": "string",
"title": "Repositories URL",
"description": "URL to organization's repositories"
},
"eventsUrl": {
"type": "string",
"title": "Events URL",
"description": "URL to organization's events"
},
"hooksUrl": {
"type": "string",
"title": "Webhooks URL",
"description": "URL to organization's webhooks"
},
"issuesUrl": {
"type": "string",
"title": "Issues URL",
"description": "URL to organization's issues"
},
"membersUrl": {
"type": "string",
"title": "Members URL",
"description": "URL to organization's members"
},
"publicMembersUrl": {
"type": "string",
"title": "Public Members URL",
"description": "URL to organization's public members"
},
"avatarUrl": {
"type": "string",
"title": "Avatar URL",
"description": "Organization avatar image URL"
},
"description": {
"type": "string",
"title": "Description",
"description": "Organization description"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {}
}
```

</details>

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<details>

<summary><b>Port port-app-config.yml (click to expand)</b></summary>

```yaml showLineNumbers
resources:
- kind: organization
selector:
query: "true" # JQ boolean query. If evaluated to false - skip syncing the object.
port:
entity:
mappings:
identifier: .login
title: .name
blueprint: '"githubOrganization"'
properties:
url: .html_url
description: .description
repositories: .public_repos
createdAt: .created_at
- kind: repository
selector:
query: "true"
port:
entity:
mappings:
identifier: .name
title: .name
blueprint: '"githubRepository"'
properties:
readme: file://README.md
url: .html_url
defaultBranch: .default_branch
relations:
organization: .__organization.login
```

</details>

Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,36 @@ import DependabotAlertBlueprint from './example-repository-alerts/\_github_expor
import CodeScanAlertBlueprint from './example-repository-alerts/\_github_exporter_example_codeScan_alert_blueprint.mdx'
import PortRepositoryDependabotAlertMappingAppConfig from './example-repository-alerts/\_github_exporter_example_repo_dependabot_port_app_config.mdx'

import OrganizationBlueprint from './example-organization/\_github_exporter_example_organization_blueprint.mdx'
import OrganizationAppConfig from './example-organization/\_github_exporter_example_organization_port_app_config.mdx'


# Resource mapping examples

## Map organizations and repositories

:::info Available from v3.0.0-beta
The `organization` kind is available from version `v3.0.0-beta` onwards.
:::

The following example demonstrates how to ingest your GitHub organizations and their repositories to Port.
You can use the following Port blueprint definitions and `port-app-config.yml`:

<OrganizationBlueprint/>

<RepositoryBlueprint/>

<OrganizationAppConfig/>

:::tip learn more

- Port leverages the [JQ JSON processor](https://stedolan.github.io/jq/manual/) to map and transform GitHub objects to Port Entities.
- Click [Here](https://docs.github.com/en/rest/orgs/orgs#get-an-organization) for the GitHub organization object structure.
- Click [Here](https://docs.github.com/en/rest/repos/repos#get-a-repository) for the GitHub repository object structure.

:::

After creating the blueprints and committing the `port-app-config.yml` file, you will see new entities in Port matching your organizations and their repositories. The repositories will have a relation to their parent organization.

## Map repositories and pull requests

Expand Down
Loading