-
Notifications
You must be signed in to change notification settings - Fork 322
101 lines (85 loc) · 3.3 KB
/
sync-cli-sdk.yml
File metadata and controls
101 lines (85 loc) · 3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Sync cli-sdk into generators/cli/sdk
on:
schedule:
# Daily at 06:00 UTC (after US-Pacific EOD, before EU morning)
- cron: "0 6 * * *"
workflow_dispatch:
permissions:
contents: write
concurrency:
group: sync-cli-sdk
cancel-in-progress: true
env:
DO_NOT_TRACK: "1"
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout fern
uses: actions/checkout@v6
with:
ref: main
- name: Checkout cli-sdk at main HEAD
uses: actions/checkout@v6
with:
repository: fern-api/cli-sdk
ref: main
path: _cli-sdk
token: ${{ secrets.FERN_SUPPORT_GH_ACTIONS_PAT }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run sync script
run: bash generators/cli/scripts/sync-sdk.sh _cli-sdk
- name: Verify projected SDK builds
run: cargo build --locked --all-features
working-directory: generators/cli/sdk
- name: Check for changes
id: diff
run: |
git add -A generators/cli/sdk/
if git diff --cached --quiet; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Read provenance
if: steps.diff.outputs.changed == 'true'
id: provenance
run: |
SHA="$(head -1 generators/cli/sdk/.synced-from | sed 's/cli-sdk@//')"
SHORT="${SHA:0:7}"
echo "sha=$SHA" >> "$GITHUB_OUTPUT"
echo "short=$SHORT" >> "$GITHUB_OUTPUT"
- name: Add changelog entry
if: steps.diff.outputs.changed == 'true'
run: |
mkdir -p generators/cli/changes/unreleased
CHANGELOG_FILE="generators/cli/changes/unreleased/sync-cli-sdk-${{ steps.provenance.outputs.short }}.yml"
cat > "$CHANGELOG_FILE" <<'EOF'
- summary: |
Sync cli-sdk runtime from fern-api/cli-sdk.
type: chore
EOF
- name: Create pull request
if: steps.diff.outputs.changed == 'true'
id: cpr
uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8
with:
token: ${{ secrets.FERN_SUPPORT_GH_ACTIONS_PAT }}
# Scope staging to the synced path and the changelog entry.
add-paths: |
generators/cli/sdk/
generators/cli/changes/unreleased/
commit-message: "chore(cli-generator): sync cli-sdk@${{ steps.provenance.outputs.short }}"
title: "chore(cli-generator): sync cli-sdk@${{ steps.provenance.outputs.short }}"
body: |
Automated sync of [fern-api/cli-sdk](https://github.com/fern-api/cli-sdk) `main` HEAD into `generators/cli/sdk/`.
**Source**: `cli-sdk@${{ steps.provenance.outputs.sha }}`
Includes an unreleased changelog entry so the release automation publishes a new cli-generator Docker image after merge.
Generated by `.github/workflows/sync-cli-sdk.yml` via `generators/cli/scripts/sync-sdk.sh`.
Seed tests (`pnpm seed test --generator cli`) are the trust boundary — if they pass, a human reviewer can merge.
branch: chore/sync-cli-sdk
delete-branch: true
labels: |
cli-generator
automated