Orchestrate releases

Fern Docs supports orchestrating documentation releases based on releases from other repositories. This is useful when documenting features that depend on releases in other repositories.

This requires two GitHub Actions: one in the feature repository and one in the documentation repository.

1

Set up release notification in the feature repository

Add this GitHub Action workflow to the repository where features are released. When a new release is created with the specified tag pattern, this workflow will send a notification to your documentation repository, triggering the auto-merge process.

Replace the following placeholders with your own values:

  • <GITHUB_ACCESS_TOKEN>: GitHub token with repo scope
  • <ORG>: Organization containing the docs repository
  • <DOCS_REPO>: Docs repository name
  • <PRODUCT_RELEASE_TAG>: Product release tag
.github/workflows/notify-docs-repo.yml
1name: Notify Docs Repo
2on:
3 release:
4 types: [created]
5 tags:
6 - "<PRODUCT_RELEASE_TAG>@*"
7
8jobs:
9 notify-docs:
10 runs-on: ubuntu-latest
11 steps:
12 - name: Trigger docs repo workflow
13 run: |
14 curl -f -X POST \
15 -H "Accept: application/vnd.github.v3+json" \
16 -H "Authorization: token ${{ secrets.<GITHUB_ACCESS_TOKEN> }}" \
17 https://api.github.com/repos/<ORG>/<DOCS_REPO>/dispatches \
18 -d '{"event_type":"<PRODUCT_RELEASE_TAG>","client_payload":{"version":"${{ github.ref_name }}"}}'
2

Configure auto-merge in the documentation repository

Add this GitHub Action workflow to your documentation repository to auto-merge PRs when features are released. Replace <PRODUCT_RELEASE_TAG> with your product release tag.

.github/workflows/auto-merge-on-release.yml
1name: Auto-merge on Docs Release
2on:
3 repository_dispatch:
4 types: [<PRODUCT_RELEASE_TAG>]
5
6jobs:
7 merge-dependent-prs:
8 runs-on: ubuntu-latest
9 steps:
10 - name: Find and merge dependent PRs
11 uses: actions/github-script@v7
12 with:
13 script: |
14 const version = context.payload.client_payload.version;
15
16 // Find PRs with matching labels
17 const { data: prs } = await github.rest.pulls.list({
18 owner: context.repo.owner,
19 repo: context.repo.repo,
20 state: 'open'
21 });
22
23 for (const pr of prs) {
24 const labels = pr.labels.map(l => l.name);
25 const hasLatestLabel = labels.includes('depends-on: <PRODUCT_RELEASE_TAG>@latest');
26 const hasVersionLabel = labels.includes(`depends-on: <PRODUCT_RELEASE_TAG>@${version}`);
27
28 if (hasLatestLabel || hasVersionLabel) {
29 // Check if PR is approved
30 const { data: reviews } = await github.rest.pulls.listReviews({
31 owner: context.repo.owner,
32 repo: context.repo.repo,
33 pull_number: pr.number
34 });
35
36 const approved = reviews.some(r => r.state === 'APPROVED');
37
38 if (approved) {
39 await github.rest.pulls.merge({
40 owner: context.repo.owner,
41 repo: context.repo.repo,
42 pull_number: pr.number,
43 merge_method: 'squash'
44 });
45
46 console.log(`Merged PR #${pr.number}: ${pr.title}`);
47 }
48 }
49 }