Skip to content

Commit 113a3fb

Browse files
authored
Merge branch 'main' into NEXUS-190
2 parents f6a75d7 + e3cd4d3 commit 113a3fb

20 files changed

Lines changed: 544 additions & 172 deletions

File tree

.github/workflows/snipsync.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Snipsync
2+
3+
on:
4+
schedule:
5+
- cron: '0 6 * * *' # Daily at 6:00 UTC
6+
workflow_dispatch:
7+
8+
jobs:
9+
snipsync:
10+
name: Sync code snippets
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
steps:
16+
- name: Generate token
17+
id: generate_token
18+
uses: actions/create-github-app-token@v1
19+
with:
20+
app-id: ${{ secrets.TEMPORAL_CICD_APP_ID }}
21+
private-key: ${{ secrets.TEMPORAL_CICD_PRIVATE_KEY }}
22+
23+
- name: Checkout
24+
uses: actions/checkout@v6
25+
with:
26+
token: ${{ steps.generate_token.outputs.token }}
27+
ref: main
28+
29+
- name: Setup Node
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: 20
33+
cache: yarn
34+
35+
- name: Install dependencies
36+
run: yarn install --frozen-lockfile
37+
38+
- name: Run snipsync
39+
run: yarn snipsync
40+
41+
- name: Check for changes
42+
id: changes
43+
run: |
44+
if git diff --quiet; then
45+
echo "has_changes=false" >> "$GITHUB_OUTPUT"
46+
else
47+
echo "has_changes=true" >> "$GITHUB_OUTPUT"
48+
fi
49+
50+
- name: Commit and push changes
51+
if: steps.changes.outputs.has_changes == 'true'
52+
run: |
53+
git config user.name "github-actions[bot]"
54+
git config user.email "github-actions[bot]@users.noreply.github.com"
55+
56+
branch_name="snipsync/daily-update"
57+
git checkout -B "$branch_name"
58+
git add docs/
59+
git commit -m "chore: sync code snippets via snipsync"
60+
git push --force-with-lease origin "$branch_name"
61+
62+
- name: Create or update PR
63+
if: steps.changes.outputs.has_changes == 'true'
64+
env:
65+
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
66+
run: |
67+
branch_name="snipsync/daily-update"
68+
existing_pr=$(gh pr list --head "$branch_name" --state open --json number --jq '.[0].number')
69+
70+
if [ -n "$existing_pr" ]; then
71+
echo "PR #$existing_pr already exists — updated with latest push."
72+
else
73+
gh pr create \
74+
--title "chore: sync code snippets" \
75+
--body "$(cat <<'EOF'
76+
Automated daily sync of code snippets from source repositories via snipsync.
77+
78+
This PR was generated by the [Snipsync workflow](https://github.com/${{ github.repository }}/actions/workflows/snipsync.yml).
79+
EOF
80+
)" \
81+
--head "$branch_name" \
82+
--base "main"
83+
fi

docs/develop/go/cancellation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func YourWorkflow(ctx workflow.Context) error {
5252
WaitForCancellation: true,
5353
}
5454
defer func() {
55-
// This logic ensures cleanup only happens if there is a Cancellation error
55+
// This logic ensures cleanup only happens if there is a Cancelation error
5656
if !errors.Is(ctx.Err(), workflow.ErrCanceled) {
5757
return
5858
}

docs/develop/go/temporal-nexus.mdx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,45 @@ func HelloCallerWorkflow(ctx workflow.Context, name string, language service.Lan
336336
```
337337
<!--SNIPEND-->
338338

339+
### Set Nexus Operation timeouts
340+
341+
Nexus Operations support [three types of timeouts](/nexus/operations#timeouts) that control how long the caller is willing to wait at different stages of the Operation lifecycle.
342+
Set these timeouts in `NexusOperationOptions` when calling `ExecuteOperation`.
343+
344+
#### Schedule-to-Close timeout
345+
346+
The [Schedule-to-Close timeout](/nexus/operations#schedule-to-close-timeout) limits the total duration of the Operation from when it is scheduled to when it completes.
347+
The Nexus Machinery automatically retries failed requests until this timeout is exceeded.
348+
349+
```go
350+
fut := c.ExecuteOperation(ctx, service.HelloOperationName, service.HelloInput{Name: name, Language: language}, workflow.NexusOperationOptions{
351+
ScheduleToCloseTimeout: 10 * time.Minute,
352+
})
353+
```
354+
355+
#### Schedule-to-Start timeout
356+
357+
The [Schedule-to-Start timeout](/nexus/operations#schedule-to-start-timeout) limits how long the caller will wait for the Operation to be started by the handler.
358+
If not set, no Schedule-to-Start timeout is enforced.
359+
360+
```go
361+
fut := c.ExecuteOperation(ctx, service.HelloOperationName, service.HelloInput{Name: name, Language: language}, workflow.NexusOperationOptions{
362+
ScheduleToStartTimeout: 2 * time.Minute,
363+
})
364+
```
365+
366+
#### Start-to-Close timeout
367+
368+
The [Start-to-Close timeout](/nexus/operations#start-to-close-timeout) limits how long the caller will wait for an asynchronous Operation to complete after it has been started.
369+
This timeout only applies to asynchronous Operations.
370+
If not set, no Start-to-Close timeout is enforced.
371+
372+
```go
373+
fut := c.ExecuteOperation(ctx, service.HelloOperationName, service.HelloInput{Name: name, Language: language}, workflow.NexusOperationOptions{
374+
StartToCloseTimeout: 5 * time.Minute,
375+
})
376+
```
377+
339378
### Register the caller Workflow in a Worker
340379

341380
After developing the caller Workflow, the next step is to register it with a Worker.

0 commit comments

Comments
 (0)