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: README.md
+49-9Lines changed: 49 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,8 @@ A GitHub Action to sync files/folders from your source repository to a target re
4
4
5
5
## Usage
6
6
7
+
### Case 1: Sync files/folders between repositories
8
+
7
9
1. In your your source repo, create a file named `sync-openapi.yml` in `.github/workflows/`.
8
10
2. Include the following contents in `sync-openapi.yml`:
9
11
@@ -23,7 +25,7 @@ jobs:
23
25
steps:
24
26
- uses: actions/checkout@v4
25
27
- name: Sync OpenAPI spec to target repo
26
-
uses: fern-api/sync-openapi@v0
28
+
uses: fern-api/sync-openapi@v2
27
29
with:
28
30
repository: <your-org>/<your-target-repo>
29
31
token: ${{ secrets.<PAT_TOKEN_NAME> }}
@@ -43,15 +45,53 @@ jobs:
43
45
44
46
```
45
47
48
+
### Case 2: Sync specs using `fern api update`
49
+
50
+
1. In your your source repo, create a file named `sync-openapi.yml` in `.github/workflows/`.
51
+
2. Include the following contents in `sync-openapi.yml`:
52
+
53
+
```yaml
54
+
name: Sync OpenAPI Specs # can be customized
55
+
on: # additional custom triggers can be configured, examples below
56
+
workflow_dispatch: # manual dispatch
57
+
push:
58
+
branches:
59
+
- main # on push to main
60
+
schedule:
61
+
- cron: '0 3 * * *'# everyday at 3:00 AM UTC
62
+
63
+
jobs:
64
+
update-from-source:
65
+
runs-on: ubuntu-latest
66
+
steps:
67
+
- uses: actions/checkout@v4
68
+
with:
69
+
token: ${{ secrets.OPENAPI_SYNC_TOKEN }}
70
+
- name: Update API with Fern
71
+
uses: fern-api/sync-openapi@v2
72
+
with:
73
+
update_from_source: true
74
+
token: ${{ secrets.OPENAPI_SYNC_TOKEN }}
75
+
branch: 'update-api'
76
+
auto_merge: false # you MUST use auto_merge: true with branch: main
77
+
add_timestamp: true
78
+
79
+
```
80
+
81
+
82
+
46
83
## Inputs
47
84
48
-
| Input | Description | Required | Default |
49
-
|-------|-------------|----------|---------|
50
-
|`repository`| Target repository in format `org/repo`| Yes | - |
51
-
|`sources`| Array of mappings with from, to, and (optional) exclude fields | Yes | - |
52
-
|`token`| GitHub token for authentication | No |`${{ github.token }}`|
53
-
|`branch`| Branch to push to in the target repository | Yes | - |
54
-
|`auto_merge`| Will push directly to the specified branch when `true`, will create a PR from the specified base branch onto main if `false`. | No |`false`|
0 commit comments