You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build-your-software-catalog/sync-data-to-catalog/git/github-ocean/github-ocean.md
+94-31Lines changed: 94 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,6 @@ import GitHubResources from './\_github_exporter_supported_resources.mdx'
10
10
11
11
Port's GitHub self-hosted integration allows you to model GitHub resources in your software catalog and ingest data into them.
12
12
13
-
14
13
## Overview
15
14
16
15
Here's what you can do with the GitHub integration:
@@ -36,10 +35,11 @@ organizations:
36
35
- org2
37
36
# ... rest of your mapping (repositoryType, resources, etc.) ...
38
37
```
39
-
</details>
40
38
39
+
</details>
41
40
42
41
:::caution Authentication and configuration requirements:
42
+
43
43
-**With classic PAT**:
44
44
- Specify organizations in port mapping: `organizations: ["org1", "org2", "org3"]`
45
45
-**With GitHub App or Fine-grained PAT**: Specify exactly one organization by setting the `githubOrganization` in the environment variables: `githubOrganization: "my-org"`
@@ -49,20 +49,17 @@ organizations:
49
49
**Performance consideration:** Syncing multiple organizations will increase the number of API calls to GitHub and may slow down the integration. The more organizations you sync, the longer the resync time and the higher the API rate limit consumption. Consider syncing only the organizations you need.
50
50
:::
51
51
52
-
53
52
### Supported resources
54
53
55
54
The resources that can be ingested from GitHub into Port are listed below.
56
55
It is possible to reference any field that appears in the API responses linked below in the mapping configuration.
57
56
58
57
<GitHubResources/>
59
58
60
-
61
59
## Setup
62
60
63
61
To install the integration, see the [installation page](./installation).
64
62
65
-
66
63
## Configuration
67
64
68
65
Port integrations use a [YAML mapping block](/build-your-software-catalog/customize-integrations/configure-mapping#configuration-structure) to ingest data from the third-party api into Port.
@@ -88,15 +85,15 @@ The `repositoryType` parameter filters which repositories are ingested. It corre
88
85
<details>
89
86
<summary><b>Possible values (Click to expand)</b></summary>
90
87
91
-
*`all` (default): All repositories accessible to the provided token.
92
-
*`public`: Public repositories.
93
-
*`private`: Private repositories.
94
-
*`forks`: Only forked repositories.
95
-
*`sources`: Only non-forked repositories.
88
+
-`all` (default): All repositories accessible to the provided token.
89
+
-`public`: Public repositories.
90
+
-`private`: Private repositories.
91
+
-`forks`: Only forked repositories.
92
+
-`sources`: Only non-forked repositories.
96
93
</details>
97
94
98
95
See the default mapping below for a usage example.
99
-
96
+
100
97
### Default mapping configuration
101
98
102
99
This is the default mapping configuration for this integration:
@@ -105,19 +102,19 @@ This is the default mapping configuration for this integration:
105
102
<summary><b>Default mapping configuration (Click to expand)</b></summary>
106
103
107
104
```yaml showLineNumbers
108
-
repositoryType: 'all'
105
+
repositoryType: "all"
109
106
deleteDependentEntities: true
110
107
createMissingRelatedEntities: true
111
108
resources:
112
109
- kind: organization
113
110
selector:
114
-
query: 'true'
111
+
query: "true"
115
112
port:
116
113
entity:
117
114
mappings:
118
115
identifier: .login
119
116
title: .login
120
-
blueprint: '''githubOrganization'''
117
+
blueprint: '"githubOrganization"'
121
118
properties:
122
119
login: .login
123
120
id: .id
@@ -133,7 +130,7 @@ resources:
133
130
description: if .description then .description else "" end
134
131
- kind: repository
135
132
selector:
136
-
query: 'true'
133
+
query: "true"
137
134
port:
138
135
entity:
139
136
mappings:
@@ -151,7 +148,7 @@ resources:
151
148
organization: .owner.login
152
149
- kind: pull-request
153
150
selector:
154
-
query: 'true'
151
+
query: "true"
155
152
state: "open"
156
153
port:
157
154
entity:
@@ -171,20 +168,18 @@ resources:
171
168
prNumber: ".id"
172
169
link: ".html_url"
173
170
leadTimeHours: >-
174
-
(.created_at as $createdAt | .merged_at as $mergedAt |
@@ -199,7 +194,6 @@ The GitHub integration uses a YAML configuration file to describe the ETL proces
199
194
200
195
The GitHub integration automatically syncs organization-level data (available from **v3.0.0-beta**).
201
196
202
-
203
197
:::tip Organization as parent entity
204
198
Organizations serve as parent entities for repositories, teams, and other GitHub resources, helping you model your organizational structure in Port.
205
199
:::
@@ -247,14 +241,14 @@ resources:
247
241
```
248
242
</details>
249
243
250
-
251
244
:::tip Test your mapping
252
-
After adding the `file` kind to your mapping configuration, click on the `Resync` button. When you open the mapping configuration again, you will see real examples of files fetched from your GitHub organization.
245
+
After adding the `file` kind to your mapping configuration, click on the `Resync` button. When you open the mapping configuration again, you will see real examples of files fetched from your GitHub organization.
253
246
254
-
This will help you see what data is available to use in your `jq` expressions.
247
+
This will help you see what data is available to use in your `jq` expressions.
255
248
Click on the `Test mapping` button to test your mapping against the example data.
256
249
257
250
In any case, the structure of the available data looks like this:
251
+
258
252
<details>
259
253
<summary><b>Available data example (click to expand)</b></summary>
260
254
@@ -734,6 +728,7 @@ In any case, the structure of the available data looks like this:
734
728
}
735
729
}
736
730
```
731
+
737
732
</details>
738
733
:::
739
734
@@ -783,7 +778,7 @@ For multi-document YAML files (a single file containing multiple YAML documents
783
778
784
779
You can use one of these methods to ingest multi-document YAML files:
785
780
786
-
1. Use the `itemsToParse` key to create multiple entities from such a file (see example above).
781
+
1. Use the `itemsToParse` key to create multiple entities from such a file (see example above).
787
782
2. Map the result to an `array` property.
788
783
789
784
:::tip Mixed YAML types
@@ -792,13 +787,13 @@ If you have both single-document and multi-document YAML files in your repositor
792
787
```yaml
793
788
itemsToParse: .content | if type== "object" then [.] else . end
794
789
```
795
-
:::
796
790
791
+
:::
797
792
798
793
#### Ingest raw file content
799
794
800
795
If you need to ingest the raw content of a file without parsing it, you can use the `skipParsing` key in your file selector.
801
-
This is useful when you want to store the file content as a string or YAML property.
796
+
This is useful when you want to store the file content as a string or YAML property.
802
797
803
798
When `skipParsing` is set to `true`, the file content will be kept in its original string format instead of being parsed into a JSON/YAML object.
804
799
@@ -835,6 +830,74 @@ resources:
835
830
- Only JSON and YAML formats are automatically parsed.
836
831
Other file formats can be ingested as raw files, however, some special characters in the file (such as `\n`) may be processed and not preserved.
837
832
833
+
### Ingest repositories via search API
834
+
835
+
Port's Github integration allows you to ingest repositories using the [Github repository search API](https://docs.github.com/en/search-github/searching-on-github/searching-for-repositories). This feature provides granular control over ingested repositories, making the integration more capable and flexible.
836
+
837
+
<details>
838
+
<summary><b>Example mapping (click to expand)</b></summary>
839
+
840
+
```yaml showLineNumbers
841
+
resources:
842
+
- kind: repository
843
+
selector:
844
+
query: "true"
845
+
repoSearch:
846
+
query: "dev in:name archived:false"
847
+
port:
848
+
entity:
849
+
mappings:
850
+
identifier: .name
851
+
title: .name
852
+
blueprint: '"githubRepository"'
853
+
properties:
854
+
description: if .description then .description else "" end
855
+
visibility: if .private then "private" else "public" end
856
+
defaultBranch: .default_branch
857
+
readme: file://README.md
858
+
url: .html_url
859
+
language: if .language then .language else "" end
860
+
- kind: pull-request
861
+
selector:
862
+
query: "true"
863
+
repoSearch:
864
+
query: "dev in:name archived:false" # repo search is also supported in pull requests.
865
+
state: open
866
+
port:
867
+
entity:
868
+
mappings:
869
+
identifier: .head.repo.name + (.id|tostring)
870
+
title: .title
871
+
blueprint: '"githubPullRequest"'
872
+
properties:
873
+
creator: .user.login
874
+
assignees: "[.assignees[].login]"
875
+
reviewers: "[.requested_reviewers[].login]"
876
+
status: .state
877
+
closedAt: .closed_at
878
+
updatedAt: .updated_at
879
+
mergedAt: .merged_at
880
+
createdAt: .created_at
881
+
prNumber: .id
882
+
link: .html_url
883
+
relations:
884
+
repository: .__repository
885
+
```
886
+
887
+
</details>
888
+
889
+
The repository search feature supports all resource kinds except `team`, `user`, `file`, and `folder`. To learn more about repository search, see the [GitHub documentation](https://docs.github.com/en/search-github/searching-on-github/searching-for-repositories).
890
+
891
+
#### Benefits
892
+
893
+
- **Granular filtering**: Precisely control which repositories are ingested..
894
+
895
+
#### Limitations
896
+
897
+
The repository search feature is subject to the limitations of the GitHub Search API:
898
+
899
+
- **Search results are limited to 1,000 items**: You can only ingest a maximum of 1,000 repositories per search query.
900
+
- **Strict rate limits**: The API allows a maximum of 30 requests per minute.
0 commit comments