Skip to content

Replace pr-docs-hook with gh aw agentic workflow - #15916

Merged
David Pine (IEvangelist) merged 2 commits into
microsoft:mainfrom
IEvangelist:dapine/gh-aw-docs-pr-hook
Apr 7, 2026
Merged

David Pine (IEvangelist) merged 2 commits into
microsoft:mainfrom
IEvangelist:dapine/gh-aw-docs-pr-hook

Conversation

@IEvangelist

Copy link
Copy Markdown
Member

Description

Replaces the broken pr-docs-hook.yml workflow with a new GitHub Agentic Workflow (pr-docs-check.md) powered by gh aw.

What was wrong

  • The old workflow relied on an expired PAT (DOCS_COPILOT_TOKEN) for Copilot CLI authentication
  • Results were only visible in the workflow run logs — nobody was checking them
  • Cross-repo issue creation on microsoft/aspire.dev was also broken due to the expired token

What this PR does

  • New agentic workflow (pr-docs-check.md): Uses an AI coding agent to analyze merged PRs for documentation needs and create draft PRs on microsoft/aspire.dev with actual documentation changes
  • Triggers: On merged PRs against main and release/* branches (plus workflow_dispatch for manual runs)
  • Doc-writer SKILL: The agent checks out microsoft/aspire.dev and follows its .github/skills/doc-writer/SKILL.md guidelines for writing documentation
  • Draft PRs instead of issues: Creates actionable draft PRs with real documentation changes, not just tracking issues
  • Cross-linking: The draft PR on aspire.dev links back to the source aspire PR; a comment on the aspire PR links forward to the draft PR (bi-directional)
  • Safe outputs: Agent runs read-only in a sandboxed container; a separate gated job creates the PR and comment with scoped write permissions
  • GitHub App auth: Uses ASPIRE_BOT_APP_ID + ASPIRE_BOT_PRIVATE_KEY for cross-repo authentication — no PATs to expire
  • Gitignore: Adds .github/aw/logs/ to prevent local agentic workflow debug logs from being committed
  • Recompiled: daily-repo-status.lock.yml recompiled with gh aw v0.67.1

Files removed

  • .github/workflows/pr-docs-hook.yml — broken workflow with expired PAT
  • .github/prompts/docs-audit-prompt.md — old prompt file, logic now embedded in the workflow markdown

Replaces #14526

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Replace the broken pr-docs-hook.yml workflow (expired PAT, Copilot CLI)
with a new GitHub Agentic Workflow (pr-docs-check.md) that:

- Triggers on merged PRs against main and release/* branches
- Analyzes the PR diff for documentation needs using an AI agent
- Checks out microsoft/aspire.dev and follows the doc-writer SKILL
- Creates a draft PR on microsoft/aspire.dev with actual docs changes
- Comments on the original aspire PR with a link to the draft PR
- Uses GitHub App auth (ASPIRE_BOT_APP_ID/ASPIRE_BOT_PRIVATE_KEY)
  for cross-repo operations instead of expiring PATs

Also recompiles daily-repo-status.lock.yml with gh aw v0.67.1.

Replaces #14526

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 7, 2026 01:56
@github-actions

github-actions Bot commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15916

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15916"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Replaces the legacy PR docs hook workflow (Copilot CLI + PAT) with a gh aw Agentic Workflow that analyzes merged PRs for doc impact and, when needed, drafts documentation PRs in microsoft/aspire.dev with safe-output gating.

Changes:

  • Remove the broken .github/workflows/pr-docs-hook.yml workflow and its prompt file.
  • Add a new agentic workflow definition (pr-docs-check.md) plus its compiled workflow (pr-docs-check.lock.yml).
  • Update infra/agentic workflow support files: ignore local AW logs, add .github/aw/actions-lock.json, and recompile daily-repo-status.lock.yml with gh aw v0.67.1.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
.gitignore Ignore local Agentic Workflow debug logs under .github/aw/logs/.
.github/workflows/pr-docs-hook.yml Removed broken legacy docs-check workflow (expired PAT-based auth).
.github/workflows/pr-docs-check.md Added new agentic workflow source definition for docs analysis and draft PR creation.
.github/workflows/pr-docs-check.lock.yml Added compiled GitHub Actions workflow generated by gh aw compile.
.github/workflows/daily-repo-status.lock.yml Recompiled existing lock workflow with newer gh aw version.
.github/prompts/docs-audit-prompt.md Removed legacy prompt file (logic now embedded in workflow markdown).
.github/aw/actions-lock.json Added action pin lock metadata for agentic workflow compilation.

Comment thread .github/workflows/pr-docs-check.md Resolved
Comment thread .github/workflows/pr-docs-check.md Resolved
- Add owner/repositories to checkout github-app so the token is
  scoped to aspire.dev (not the current repo)
- Add 'aspire' to tools.github repositories so the agent can read
  PR details/diff from the source repo

Addresses Copilot review feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gh awwwwwwww so cute

@IEvangelist
David Pine (IEvangelist) enabled auto-merge (squash) April 7, 2026 02:15
@IEvangelist

Copy link
Copy Markdown
Member Author

/create-issue

failed Aspire.Cli.EndToEnd.Tests.JavaPolyglotTests.CreateJavaAppHostWithViteApp (325ms)
Xunit.Runner.InProc.SystemConsole.TestingPlatform.XunitException: System.InvalidOperationException : Failed to build shared polyglot Docker base image.

Dockerfile.e2e-polyglot-base:21

19 |     # Produces NuGet packages and the native AOT CLI binary.
20 |     # Skipped when SKIP_SOURCE_BUILD=true (CI mode).
21 | >>> FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
22 |     
23 |     ARG SKIP_SOURCE_BUILD=false

ERROR: failed to build: failed to solve: mcr.microsoft.com/dotnet/sdk:10.0: failed to resolve source metadata for mcr.microsoft.com/dotnet/sdk:10.0: unexpected status from HEAD request to https://mcr.microsoft.com/v2/dotnet/sdk/manifests/10.0: 429 Too Many Requests

@IEvangelist
David Pine (IEvangelist) merged commit e010b0c into microsoft:main Apr 7, 2026
522 of 526 checks passed
Ankit Jain (radical) pushed a commit that referenced this pull request Apr 7, 2026
* Replace pr-docs-hook with gh aw agentic workflow

Replace the broken pr-docs-hook.yml workflow (expired PAT, Copilot CLI)
with a new GitHub Agentic Workflow (pr-docs-check.md) that:

- Triggers on merged PRs against main and release/* branches
- Analyzes the PR diff for documentation needs using an AI agent
- Checks out microsoft/aspire.dev and follows the doc-writer SKILL
- Creates a draft PR on microsoft/aspire.dev with actual docs changes
- Comments on the original aspire PR with a link to the draft PR
- Uses GitHub App auth (ASPIRE_BOT_APP_ID/ASPIRE_BOT_PRIVATE_KEY)
  for cross-repo operations instead of expiring PATs

Also recompiles daily-repo-status.lock.yml with gh aw v0.67.1.

Replaces #14526

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix checkout and tools token scoping for cross-repo access

- Add owner/repositories to checkout github-app so the token is
  scoped to aspire.dev (not the current repo)
- Add 'aspire' to tools.github repositories so the agent can read
  PR details/diff from the source repo

Addresses Copilot review feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@joperezr

Copy link
Copy Markdown
Member

Post-merge review notes

A few observations from reviewing this PR that could be considered for a follow-up if needed:


1. Over-permissioned conclusion job

File: pr-docs-check.lock.yml — conclusion job

The conclusion job declares contents: write, discussions: write, issues: write, and pull-requests: write. From what I can tell, it only creates failure-tracking issues and processes no-op/missing-tool messages. Reducing the permissions to just issues: write would tighten the blast radius.


2. aspire repo checkout overwritten by aspire.dev checkout

File: pr-docs-check.lock.yml — agent job, checkout steps

The agent job checks out microsoft/aspire and then immediately checks out microsoft/aspire.dev into the same workspace directory, overwriting the first. The agent therefore depends entirely on the GitHub MCP Server API to read aspire PR details rather than local files. This works, but it would be worth documenting explicitly (either in the .md source or in a comment) so that future maintainers understand why the aspire checkout isn't used directly.


3. AGENTS.md protection discrepancy between source and compiled output

File: pr-docs-check.md vs pr-docs-check.lock.yml

The compiled lock file includes "AGENTS.md" in the protected_files list for the create_pull_request safe output, but the source pr-docs-check.md does not declare this in its frontmatter. If the compiler auto-injects it, that's fine — but the source .md should ideally be self-documenting so reviewers don't have to diff against the lock file to understand the full config.


4. Fork PRs silently excluded (behavioral change from old workflow)

File: pr-docs-check.lock.yml — pre_activation job

The old pr-docs-hook.yml used pull_request_target, which ran for fork PRs. The new workflow checks github.event.pull_request.head.repo.id == github.repository_id, explicitly blocking forks. This is a security improvement, but it means external contributor PRs merged from forks will not trigger the documentation check. Worth documenting this as a known limitation or adding a workflow_dispatch fallback note for maintainers who want to run the check manually for fork PRs.

@IEvangelist

Copy link
Copy Markdown
Member Author

Those are good callouts Jose Perez Rodriguez (@joperezr) - see #15923

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants