Skip to content

GH-2212: Replace search-based parent closing with native GraphQL + fa… #67

GH-2212: Replace search-based parent closing with native GraphQL + fa…

GH-2212: Replace search-based parent closing with native GraphQL + fa… #67

name: Sync Docs Version
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Version tag (e.g. v2.87.2)'
required: true
permissions:
contents: write
pull-requests: write
jobs:
sync-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Get release version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" = "push" ]; then
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
echo "VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
fi
- name: Close previous version-sync PRs
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr list --state open --search "docs: sync version to" --json number,headRefName --jq '.[]' | while read -r line; do
pr_num=$(echo "$line" | jq -r '.number')
branch=$(echo "$line" | jq -r '.headRefName')
gh pr close "$pr_num" --comment "Superseded by ${{ steps.version.outputs.VERSION }}" --delete-branch || true
done
- name: Run version sync script
run: ./scripts/docs-version-sync.sh ${{ steps.version.outputs.VERSION }}
- name: Check for changes
id: changes
run: |
if git diff --quiet; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
if: steps.changes.outputs.changed == 'true'
id: pr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "docs: sync version to ${{ steps.version.outputs.VERSION }}"
title: "docs: sync version to ${{ steps.version.outputs.VERSION }}"
body: |
Automated PR to update version references in Navigator docs after release.
Updated files:
- `.agent/DEVELOPMENT-README.md`
- `.agent/system/FEATURE-MATRIX.md`
- `docs/app/layout.tsx` (navbar version)
Created by docs-version-sync workflow.
branch: docs/version-sync-${{ steps.version.outputs.VERSION }}
base: main
labels: documentation
- name: Enable auto-merge
if: steps.changes.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ -n "${{ steps.pr.outputs.pull-request-number }}" ]; then
gh pr merge "${{ steps.pr.outputs.pull-request-number }}" --auto --squash
fi