Skip to content

Commit 9136e7a

Browse files
authored
Merge pull request #2944 from port-labs/PORT-16638-Fix-Default-Mapping-For-GitHub-Ocean
feat: sanitize GitHub user identifiers to handle special characters
2 parents e381dfd + 52435ac commit 9136e7a

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

docs/build-your-software-catalog/sync-data-to-catalog/git/github-ocean/examples/_github_exporter_example_port_app_config.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ resources:
3030
title: ".title"
3131
blueprint: '"githubPullRequest"'
3232
properties:
33-
creator: ".user.login"
34-
assignees: "[.assignees[].login]"
35-
reviewers: "[.requested_reviewers[].login]"
33+
creator: (.user.login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; ""))
34+
assignees: '[.assignees[].login | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")]'
35+
reviewers: '[.requested_reviewers[].login | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")]'
3636
status: ".state" # merged, closed, opened
3737
closedAt: ".closed_at"
3838
updatedAt: ".updated_at"

docs/build-your-software-catalog/sync-data-to-catalog/git/github-ocean/examples/example-repository-admins/_github_exporter_example_admins_users_port_app_config.mdx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import Tabs from "@theme/Tabs"
2+
import TabItem from "@theme/TabItem"
3+
14
<details>
25

36
<summary><b> Port port-app-config.yml (click to expand)</b></summary>
@@ -20,14 +23,15 @@ resources:
2023
url: .html_url
2124
defaultBranch: .default_branch
2225
relations:
23-
admins: "[.__collaborators[] | select(.is_admin == true) | .login]"
26+
admins: "[.__collaborators[] | select(.is_admin == true) | .login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")]"
2427
- kind: user
2528
selector:
2629
query: "true"
30+
includeBots: "false"
2731
port:
2832
entity:
2933
mappings:
30-
identifier: .login
34+
identifier: .login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")
3135
title: if (.name != "" and .name) then .name else .login end
3236
blueprint: '"githubUser"'
3337
relations:
@@ -46,3 +50,21 @@ resources:
4650
```
4751
4852
</details>
53+
54+
<Tabs groupId="config" queryString="parameter">
55+
56+
<TabItem label="Include Bot Users" value="includeBots">
57+
58+
The `includeBots` selector is used to include bot users in the sync process. By default, it is set to `false`.
59+
60+
```yaml
61+
- kind: user
62+
selector:
63+
query: 'true'
64+
# highlight-next-line
65+
includeBots: 'false'
66+
```
67+
68+
</TabItem>
69+
70+
</Tabs>

docs/build-your-software-catalog/sync-data-to-catalog/git/github-ocean/examples/example-team-members/_github_team_member_port_app_config.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<details>
2-
<summary><b>Port port-app-config.yaml (click to expand)</b></summary>
2+
<summary><b>Port port-app-config.yaml (click to expand)</b></summary>
33

44
```yaml showLineNumbers
55
- kind: team
@@ -19,7 +19,7 @@
1919
permission: .permission
2020
notification_setting: .notificationSetting
2121
relations:
22-
team_member: '[.members.nodes[].login]'
22+
team_member: '[.members.nodes[].login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")]'
2323
- kind: team
2424
selector:
2525
query: 'true'
@@ -28,7 +28,7 @@
2828
itemsToParse: .members.nodes
2929
entity:
3030
mappings:
31-
identifier: .login
31+
identifier: .login | gsub("\\["; "-") | gsub("\\](?=[^$])"; "-") | gsub("\\]$"; "")
3232
title: .login
3333
blueprint: '"githubTeamMember"'
3434
properties:

0 commit comments

Comments
 (0)