diff --git a/fern/products/docs/docs.yml b/fern/products/docs/docs.yml index eac98df90..027d677e8 100644 --- a/fern/products/docs/docs.yml +++ b/fern/products/docs/docs.yml @@ -251,6 +251,8 @@ navigation: - section: Developer tools collapsed: true contents: + - page: Orchestrate GitHub releases + path: ./pages/developer-tools/orchestrate-docs-releases.mdx - page: Cursor path: ./pages/developer-tools/cursor.mdx - page: GitLab diff --git a/fern/products/docs/pages/developer-tools/orchestrate-docs-releases.mdx b/fern/products/docs/pages/developer-tools/orchestrate-docs-releases.mdx new file mode 100644 index 000000000..f03da117a --- /dev/null +++ b/fern/products/docs/pages/developer-tools/orchestrate-docs-releases.mdx @@ -0,0 +1,99 @@ +--- +title: Orchestrate releases +description: Coordinate documentation updates across multiple repositories and 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. + + + + +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 token with `repo` scope +- ``: Organization containing the docs repository +- ``: Docs repository name +- ``: Product release tag + +```yml title=".github/workflows/notify-docs-repo.yml" +name: Notify Docs Repo +on: + release: + types: [created] + tags: + - "@*" + +jobs: + notify-docs: + runs-on: ubuntu-latest + steps: + - name: Trigger docs repo workflow + run: | + curl -f -X POST \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${{ secrets. }}" \ + https://api.github.com/repos///dispatches \ + -d '{"event_type":"","client_payload":{"version":"${{ github.ref_name }}"}}' +``` + + + + +Add this GitHub Action workflow to your documentation repository to auto-merge PRs when features are released. Replace `` with your product release tag. + +```yml title=".github/workflows/auto-merge-on-release.yml" +name: Auto-merge on Docs Release +on: + repository_dispatch: + types: [] + +jobs: + merge-dependent-prs: + runs-on: ubuntu-latest + steps: + - name: Find and merge dependent PRs + uses: actions/github-script@v7 + with: + script: | + const version = context.payload.client_payload.version; + + // Find PRs with matching labels + const { data: prs } = await github.rest.pulls.list({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open' + }); + + for (const pr of prs) { + const labels = pr.labels.map(l => l.name); + const hasLatestLabel = labels.includes('depends-on: @latest'); + const hasVersionLabel = labels.includes(`depends-on: @${version}`); + + if (hasLatestLabel || hasVersionLabel) { + // Check if PR is approved + const { data: reviews } = await github.rest.pulls.listReviews({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: pr.number + }); + + const approved = reviews.some(r => r.state === 'APPROVED'); + + if (approved) { + await github.rest.pulls.merge({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: pr.number, + merge_method: 'squash' + }); + + console.log(`Merged PR #${pr.number}: ${pr.title}`); + } + } + } +``` + + \ No newline at end of file