Skip to content

Commit a1bd008

Browse files
authored
Merge branch 'main' into feat_fix_pipeline_relation_example
2 parents 465c3fa + 8cdf28d commit a1bd008

File tree

466 files changed

+51431
-63813
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

466 files changed

+51431
-63813
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Claude Docs PR Reviewer
2+
on:
3+
# pull_request:
4+
# types:
5+
# - synchronize
6+
# - reopened
7+
# - opened
8+
# branches:
9+
# - main
10+
workflow_dispatch:
11+
12+
jobs:
13+
check-if-to-trigger:
14+
name: Check if to trigger
15+
outputs:
16+
changed_files: ${{ steps.changed-files.outputs.any_changed }}
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v5
21+
with:
22+
fetch-depth: 1
23+
24+
- name: Check for changed files
25+
id: changed-files
26+
uses: tj-actions/changed-files@v46
27+
with:
28+
files: |
29+
docs/**
30+
31+
claude-docs-pr-reviewer:
32+
name: Claude Docs PR Reviewer
33+
needs: check-if-to-trigger
34+
if: needs.check-if-to-trigger.outputs.changed_files == 'true' && github.event.pull_request.head.repo.full_name == 'port-labs/port-docs'
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: read
38+
pull-requests: write
39+
issues: write
40+
id-token: write
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/checkout@v5
44+
with:
45+
fetch-depth: 1
46+
47+
- name: Configure Git
48+
run: |
49+
git config --global user.name "Port Claude AI"
50+
git config --global user.email "port-claude-ai@port.io"
51+
52+
- name: Find and Delete Last Claude Comment
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
run: |
56+
echo "Looking for the last Claude comment to delete..."
57+
58+
# Get the last Claude comment ID (trying common patterns)
59+
last_claude_comment=$(gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
60+
--jq '.[] | select(.user.login | test("claude"; "i")) | .id' | tail -1)
61+
62+
if [ ! -z "$last_claude_comment" ]; then
63+
echo "Deleting last Claude comment ID: $last_claude_comment"
64+
gh api repos/${{ github.repository }}/issues/comments/$last_claude_comment -X DELETE
65+
else
66+
echo "No Claude comments found to delete"
67+
fi
68+
69+
- name: Run Claude PR Action
70+
uses: anthropics/claude-code-action@beta
71+
with:
72+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
73+
allowed_tools: "Bash(git:*),Bash(gh:*),Bash(jq:*),Bash(yq:*),View,GlobTool,GrepTool,BatchTool"
74+
direct_prompt: |
75+
Please review the following PR and provide a detailed review of the changes according the ./CONTRIBUTING.md provide results in markdown format. Ignore all image files.
76+
timeout_minutes: "15"

.github/workflows/sync-docs-with-mapping-config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ jobs:
1313

1414
steps:
1515
- name: Checkout port-docs (automation tools)
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@v5
1717
with:
1818
path: port-docs
1919

2020
- name: Checkout ocean-test (YAML configs source)
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@v5
2222
with:
2323
repository: ${{ github.repository_owner }}/ocean-test
2424
token: ${{ secrets.MAPPING_PAT }}
2525
path: ocean-test
2626
ref: main
2727

2828
- name: Checkout Port-monorepo (TypeScript source)
29-
uses: actions/checkout@v4
29+
uses: actions/checkout@v5
3030
with:
3131
repository: ${{ github.repository_owner }}/Port-monorepo
3232
token: ${{ secrets.MAPPING_PAT }}

.github/workflows/updateApiSpec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
# Step 1: Checkout the repository
1818
- name: Checkout repository
19-
uses: actions/checkout@v4
19+
uses: actions/checkout@v5
2020
with:
2121
fetch-depth: 0 # Fetch all history for accurate diff
2222

@@ -35,7 +35,7 @@ jobs:
3535
- name: Check for differences
3636
id: diff_check
3737
run: |
38-
if cmp -s newSpec.yaml static/rawApiSpec.yaml; then
38+
if cmp -s newSpec.yaml static/apispec.yaml; then
3939
echo "diff_found=false" >> $GITHUB_OUTPUT
4040
echo "No changes detected."
4141
else
@@ -46,7 +46,7 @@ jobs:
4646
# Step 5: Update the YAML file in the repository if differences are found
4747
- name: Update YAML file
4848
if: steps.diff_check.outputs.diff_found == 'true'
49-
run: mv newSpec.yaml static/rawApiSpec.yaml
49+
run: mv newSpec.yaml static/apispec.yaml
5050

5151
# Step 6: Create a pull request with the changes using the hash as the branch name
5252
- name: Create Pull Request

.github/workflows/verify-docs-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
name: Test successful production build
2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v5
2222
with:
2323
persist-credentials: true
2424
- name: Install dependencies

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ yarn-error.log*
2424
.vscode
2525

2626
#workflow cache
27-
.github/script/__pycache__
27+
.github/script/__pycache__
28+
29+
# Generated guide metadata
30+
src/components/guides-section/guide-metadata.json

docs/actions-and-automations/create-self-service-experiences/setup-ui-for-action/advanced-form-configurations.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,16 @@ Keys that are supported with jqQuery expressions:
204204
| visible | the condition to display any property in the form |
205205
| disabled | the condition to disable any property in the form |
206206

207+
:::tip Check if string is empty
208+
To check if a string input is empty, compare it to an empty string, like this:
209+
210+
```json
211+
{
212+
"jqQuery": ".form.version == \"\""
213+
}
214+
```
215+
:::
216+
207217
---
208218

209219
#### Additional available properties

docs/actions-and-automations/define-automations/setup-trigger.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,13 @@ The table below describes the fields in the JSON structure under the `trigger` k
247247
| **`type`** | The automation's trigger type. Should be set to `automation`. |
248248
| **`event`** | An object containing data about the event that triggers the automation. |
249249
| **`event.type`** | The [trigger event type](/actions-and-automations/define-automations/setup-trigger#available-triggers). |
250-
| **`event.blueprintIdentifier`**<br/>or<br/>**`event.actionIdentifier`** | If using an *entity trigger* - the identifier of the blueprint whose entities will trigger the automation.<br/>If using an *action run trigger* - the identifier of the action whose runs will trigger the automation. |
250+
| **`event.blueprintIdentifier`**<br/>or<br/>**`event.actionIdentifier`** | If using an *entity trigger* - the identifier of the blueprint whose entities will trigger the automation.<br/>If using an *action run trigger* - the identifier of the action/automation whose runs will trigger the automation. |
251251
| `condition` | An optional object containing `jq` expressions used to determine which entities the automation will be triggered for. |
252252
| `condition.type` | The type of condition. Should be set to `JQ`. |
253253
| `condition.expressions` | An array of expressions used to filter the entities for which the automation will be triggered. |
254254
| `condition.combinator` | The combinator used to combine the expressions. Should be set to `and` or `or`. |
255+
256+
:::tip Automation action identifiers
257+
When using the `actionIdentifier` key, you can use an identifier that belongs to an automation as well.
258+
This means that automations can be triggered by other automations and are not limited to self-service actions.
259+
:::

docs/actions-and-automations/reflect-action-progress/reflect-action-progress.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ When using a `Webhook` as the action backend, a [`Request type` option](/actions
128128

129129
#### Run details
130130

131-
By sending a [`PATCH` request](/api-reference/patch-an-action-run) to Port's API, you can do the following:
131+
By sending a [`PATCH` request](/api-reference/update-an-action-run) to Port's API, you can do the following:
132132

133133
1. Update the run's status, by using the `status` key with one of these values: `SUCCESS`, `FAILURE`.
134134
This will mark the run as completed and show a visual indicator, for example:
@@ -190,7 +190,7 @@ A log message with the `terminationStatus` key can only be sent once for an acti
190190

191191
## Tying Entities to an action run
192192

193-
You can also add additional context and metadata to an action run by attaching a `run_id` query parameter to every API route that creates or changes an entity (i.e. [`POST`](/api-reference/create-an-entity), [`PUT`](/api-reference/change-an-entity), [`PATCH`](/api-reference/patch-an-entity) and [`DELETE`](/api-reference/delete-an-entity) entity requests).
193+
You can also add additional context and metadata to an action run by attaching a `run_id` query parameter to every API route that creates or changes an entity (i.e. [`POST`](/api-reference/create-an-entity), [`PUT`](/api-reference/change-an-entity), [`PATCH`](/api-reference/update-an-entity) and [`DELETE`](/api-reference/delete-an-entity) entity requests).
194194

195195
By adding the `run_id` parameter, you reflect the change made to the Entity as part of the set of steps the action run performed during its runtime.
196196

docs/actions-and-automations/setup-backend/create-update-entity/create-update-entity.md

Lines changed: 108 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
# Create/update entity
25

36
In some cases, we don't want to run complex logic via a workflow or pipeline, but rather want our backend to simply create or update an entity in our software catalog.
@@ -33,15 +36,15 @@ To use this backend type, you will need to define the following fields:
3336
| `team` | The team/s this entity will belong to. |
3437
| `icon` | The icon of the entity. |
3538
| `properties` | The properties of the entity, in `"key":"value"` pairs where the key is the property's identifier, and the value is its value. |
36-
| `relations` | The relations of the entity, in `"key":"value"` pairs where the key is the relation's identifier, and the value is the related entity's identifier. |
39+
| `relations` | The relations of the entity, in `"key":"value"` pairs where the key is the relation's identifier, and the value is the related entity's identifier (for single relations) or an array of identifiers (for "many" relations). |
3740

3841
### Use jq to map the entity
3942

4043
All fields in the `mapping` object can be mapped using `jq` expressions, by wrapping the value in double curly braces `{{ }}`.
4144

4245
For example, say we want to assign the initiator of the action to a new entity when it is created, we can take his email from the action run object and assign it to a property named `assignee`:
4346

44-
```json
47+
```json showLineNumbers
4548
{
4649
"identifier": "someTaskEntity",
4750
"title": "Some Task",
@@ -55,3 +58,106 @@ For example, say we want to assign the initiator of the action to a new entity w
5558
:::tip Test your mapping
5659
You can use the `Test JQ` button in the bottom-left corner to test your mapping against the action's schema.
5760
:::
61+
62+
## Map entity relations
63+
64+
When creating or updating entities, you often need to establish relations with other entities. The mapping approach depends on whether you're dealing with single or multiple entity inputs.
65+
66+
67+
<Tabs groupId="relation-mapping" defaultValue="single" values={[
68+
{label: "Single Entity", value: "single"},
69+
{label: "Array Entity", value: "array"},
70+
{label: "Flexible Mapping", value: "flexible"}
71+
]}>
72+
73+
<TabItem value="single">
74+
75+
For a single entity relation, map the entity identifier directly:
76+
77+
```json showLineNumbers
78+
{
79+
"identifier": "myServiceEntity",
80+
"title": "My Service",
81+
"properties": {},
82+
"relations": {
83+
"domain": "{{ .inputs.domain }}"
84+
}
85+
}
86+
```
87+
88+
</TabItem>
89+
90+
<TabItem value="array">
91+
92+
When your action accepts [array entity inputs](/docs/actions-and-automations/create-self-service-experiences/setup-ui-for-action/user-inputs/entity.md#array), you need to extract the identifiers from the array using the `map(.identifier)` pattern:
93+
94+
```json showLineNumbers
95+
{
96+
"identifier": "myUserEntity",
97+
"title": "My User",
98+
"properties": {},
99+
"relations": {
100+
"skills": "{{ .inputs.skills | map(.identifier) }}"
101+
}
102+
}
103+
```
104+
105+
:::info Array entity inputs
106+
When users select multiple entities from an [entity array input](/docs/actions-and-automations/create-self-service-experiences/setup-ui-for-action/user-inputs/entity.md#array), the input contains an array of entity objects. Each object includes both `identifier` and `title` properties, but relations can only reference entity identifiers.
107+
:::
108+
109+
</TabItem>
110+
111+
<TabItem value="flexible">
112+
113+
For maximum flexibility, you can create a conditional mapping that handles both single entity and array entity inputs:
114+
115+
```json showLineNumbers
116+
{
117+
"identifier": "myProjectEntity",
118+
"title": "My Project",
119+
"properties": {},
120+
"relations": {
121+
"dependencies": "{{ .inputs.dependencies | if type == \"array\" then map(.identifier) else .identifier end }}"
122+
}
123+
}
124+
```
125+
126+
This pattern automatically:
127+
- Extracts identifiers from arrays when multiple entities are selected
128+
- Uses the identifier directly when a single entity is selected
129+
130+
</TabItem>
131+
132+
</Tabs>
133+
134+
135+
### Common use cases
136+
137+
Here are some typical scenarios for mapping array relations:
138+
139+
**Mapping skills to a user:**
140+
```json showLineNumbers
141+
"relations": {
142+
"skills": "{{ .inputs.selectedSkills | map(.identifier) }}"
143+
}
144+
```
145+
146+
**Mapping team members to a project:**
147+
```json showLineNumbers
148+
"relations": {
149+
"members": "{{ .inputs.teamMembers | map(.identifier) }}"
150+
}
151+
```
152+
153+
**Mapping dependencies between services:**
154+
```json showLineNumbers
155+
"relations": {
156+
"dependsOn": "{{ .inputs.dependencies | map(.identifier) }}"
157+
}
158+
```
159+
160+
161+
:::info Entity titles in relations
162+
Relations can only reference entity **identifiers**, not titles. Even though entity objects contain both `identifier` and `title` properties, you must always use `.identifier` when mapping to relations.
163+
:::

docs/actions-and-automations/setup-backend/webhook/webhook.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Alternatively, you can set the execution type to **synchronous**, which will cau
7878
### HTTP method
7979

8080
By default, a `POST` request will be sent to the specified endpoint URL.
81-
You can change the request to any of the supported types: `POST`, `PUT`, `DELETE`, or `PATCH`.
81+
You can change the request to any of the supported types: `POST`, `GET`, `PUT`, `DELETE`, or `PATCH`.
8282

8383
## Trigger Port API
8484

0 commit comments

Comments
 (0)