Skip to content

Add doc-sync workflow for automated documentation PR generation#4832

Merged
liliankasem merged 4 commits intomainfrom
feature/doc-sync-workflow
Mar 20, 2026
Merged

Add doc-sync workflow for automated documentation PR generation#4832
liliankasem merged 4 commits intomainfrom
feature/doc-sync-workflow

Conversation

@liliankasem
Copy link
Member

@liliankasem liliankasem commented Mar 19, 2026

Add doc-sync workflow for automated documentation PR generation

Summary

Adds a GitHub Actions workflow that automatically detects CLI command changes on new releases and opens a PR in MicrosoftDocs/azure-docs-pr with a detailed change summary for documentation updates.

Problem

When CLI commands, help text, arguments, or features change in Core Tools, documentation in azure-docs-pr can become stale. There's no automated mechanism to flag what changed or prompt doc updates.

Solution

A two-job workflow triggered on release: published:

  1. extract-and-diff — Parses [Action(...)] attributes and .Setup<T>() argument definitions from all 61 CLI commands in src/Cli/func/Actions/. Uses git worktrees to extract metadata from both the previous and new release tags, then diffs the manifests to identify added, removed, and modified commands.

  2. open-docs-pr — If changes are detected, checks out MicrosoftDocs/azure-docs-pr, creates a branch with diff artifacts, and opens a PR with a markdown summary of all command changes. The PR is assigned to @copilot for AI-generated doc content.

Files

File Description
.github/workflows/doc-sync.yml The workflow definition
.github/scripts/extract_commands.py Python script for command extraction and diffing
docs/doc-sync.md Workflow documentation

What the extraction script detects

  • ✅ New commands added
  • ❌ Commands removed
  • ✏️ Help text changes
  • 🔧 Argument additions, removals, and modifications
  • 👁️ Visibility changes (ShowInHelp)

Setup required

  • A AZURE_DOCS_REPO_PAT repository secret with repo scope on MicrosoftDocs/azure-docs-pr
  • Labels doc-sync, azure-functions, core-tools in the docs repo (or remove the --label flag)

Testing

The extraction script was tested locally against the current codebase:

  • Successfully extracts 61 commands across all action categories
  • Self-diff returns no changes (correct)
  • Simulated diffs correctly identify added/removed/modified commands with argument details

liliankasem and others added 2 commits March 19, 2026 15:28
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@liliankasem liliankasem marked this pull request as ready for review March 19, 2026 23:07
@liliankasem liliankasem requested a review from a team as a code owner March 19, 2026 23:07
Monthly cron job that opens a GitHub Issue 30 days before the
AZURE_DOCS_REPO_PAT expires. Prevents silent doc-sync failures
due to expired credentials. Deduplicates — won't open a second
issue if one is already open.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Instead of a separate cron workflow, the doc-sync workflow now
opens a GitHub Issue automatically when it fails to push a PR
to the docs repo. The issue includes troubleshooting steps for
expired PATs, permission issues, and branch conflicts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@liliankasem liliankasem force-pushed the feature/doc-sync-workflow branch from c3cabe0 to 81cbcde Compare March 19, 2026 23:25
@liliankasem liliankasem merged commit e4e5c71 into main Mar 20, 2026
12 checks passed
@liliankasem liliankasem deleted the feature/doc-sync-workflow branch March 20, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants