From ea46b30a6b768adde6a4f8b32b8b6ceb083cbb3a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 12 Jan 2026 15:59:57 +0000 Subject: [PATCH 1/5] Initial plan From 0022f921657af0ceeac64abe96664da64b04f28f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 12 Jan 2026 16:04:19 +0000 Subject: [PATCH 2/5] Add docs-from-code workflow for processing labeled issues Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --- .github/workflows/docs-from-code.yml | 130 +++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 .github/workflows/docs-from-code.yml diff --git a/.github/workflows/docs-from-code.yml b/.github/workflows/docs-from-code.yml new file mode 100644 index 00000000..e98f9ea2 --- /dev/null +++ b/.github/workflows/docs-from-code.yml @@ -0,0 +1,130 @@ +name: Process Docs from Code Issues + +on: + issues: + types: [labeled] + +permissions: + contents: read + issues: write + +jobs: + assign-to-copilot: + name: Assign to Copilot Agent + runs-on: ubuntu-latest + if: github.event.label.name == 'docs-from-code' + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Extract SME from issue body + id: extract-sme + uses: actions/github-script@v7 + with: + script: | + const issueBody = context.payload.issue.body || ''; + + // Look for PR author pattern in issue body + // Expected format from dotnet/aspire workflow: "PR Author: @username" or similar + const authorPatterns = [ + /PR\s*Author:\s*@?(\w+)/i, + /Author:\s*@?(\w+)/i, + /SME:\s*@?(\w+)/i, + /Original\s*PR\s*by\s*@?(\w+)/i, + /by\s*@(\w+)/i + ]; + + let smeUsername = null; + + for (const pattern of authorPatterns) { + const match = issueBody.match(pattern); + if (match) { + smeUsername = match[1]; + break; + } + } + + // Also try to extract PR URL if present + const prUrlPattern = /https:\/\/github\.com\/dotnet\/aspire\/pull\/(\d+)/; + const prUrlMatch = issueBody.match(prUrlPattern); + + if (!smeUsername && prUrlMatch) { + // If we found a PR URL but no author, we'll need to fetch it + const prNumber = prUrlMatch[1]; + try { + const { data: pr } = await github.rest.pulls.get({ + owner: 'dotnet', + repo: 'aspire', + pull_number: parseInt(prNumber) + }); + smeUsername = pr.user.login; + console.log(`Extracted SME from PR #${prNumber}: ${smeUsername}`); + } catch (error) { + console.log(`Could not fetch PR details: ${error.message}`); + } + } + + core.setOutput('sme', smeUsername || ''); + core.setOutput('found', smeUsername ? 'true' : 'false'); + + console.log(`SME Username: ${smeUsername || 'not found'}`); + + - name: Assign issue to Copilot + uses: actions/github-script@v7 + with: + script: | + const issueNumber = context.payload.issue.number; + + // Assign the issue to copilot + try { + await github.rest.issues.addAssignees({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueNumber, + assignees: ['copilot'] + }); + console.log(`Successfully assigned issue #${issueNumber} to copilot`); + } catch (error) { + console.log(`Could not assign to copilot: ${error.message}`); + // Continue even if assignment fails + } + + - name: Add comment mentioning SME + uses: actions/github-script@v7 + with: + script: | + const issueNumber = context.payload.issue.number; + const smeUsername = '${{ steps.extract-sme.outputs.sme }}'; + const smeFound = '${{ steps.extract-sme.outputs.found }}' === 'true'; + + let commentBody = `## ๐Ÿค– Copilot Agent Assigned + + This issue has been assigned to GitHub Copilot to draft a pull request based on the description provided. + + `; + + if (smeFound && smeUsername) { + commentBody += `### ๐Ÿ“‹ SME Review Required + + @${smeUsername} - You have been identified as the subject matter expert (SME) for this documentation update based on the originating PR in the [dotnet/aspire](https://github.com/dotnet/aspire) repository. Please review the draft PR once Copilot has completed its work. + `; + } else { + commentBody += `### โš ๏ธ SME Not Found + + Could not automatically identify the SME from the issue body. Please manually tag the appropriate reviewer once the draft PR is created. + `; + } + + commentBody += ` + --- + *This comment was automatically generated by the docs-from-code workflow.*`; + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueNumber, + body: commentBody + }); + + console.log(`Added comment to issue #${issueNumber}`); From 923cdff00aa56763a42c84801d8da74806b55a85 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 12 Jan 2026 16:05:45 +0000 Subject: [PATCH 3/5] Address code review feedback for docs-from-code workflow Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --- .github/workflows/docs-from-code.yml | 33 ++++++++++------------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/.github/workflows/docs-from-code.yml b/.github/workflows/docs-from-code.yml index e98f9ea2..f588eaa4 100644 --- a/.github/workflows/docs-from-code.yml +++ b/.github/workflows/docs-from-code.yml @@ -28,11 +28,11 @@ jobs: // Look for PR author pattern in issue body // Expected format from dotnet/aspire workflow: "PR Author: @username" or similar const authorPatterns = [ - /PR\s*Author:\s*@?(\w+)/i, - /Author:\s*@?(\w+)/i, - /SME:\s*@?(\w+)/i, - /Original\s*PR\s*by\s*@?(\w+)/i, - /by\s*@(\w+)/i + /PR\s*Author:\s*@?([\w-]+)/i, + /Author:\s*@?([\w-]+)/i, + /SME:\s*@?([\w-]+)/i, + /Original\s*PR\s*by\s*@?([\w-]+)/i, + /Created\s*by\s*@([\w-]+)/i ]; let smeUsername = null; @@ -98,27 +98,18 @@ jobs: const smeUsername = '${{ steps.extract-sme.outputs.sme }}'; const smeFound = '${{ steps.extract-sme.outputs.found }}' === 'true'; - let commentBody = `## ๐Ÿค– Copilot Agent Assigned - - This issue has been assigned to GitHub Copilot to draft a pull request based on the description provided. - - `; + let commentBody = '## ๐Ÿค– Copilot Agent Assigned\n\n'; + commentBody += 'This issue has been assigned to GitHub Copilot to draft a pull request based on the description provided.\n\n'; if (smeFound && smeUsername) { - commentBody += `### ๐Ÿ“‹ SME Review Required - - @${smeUsername} - You have been identified as the subject matter expert (SME) for this documentation update based on the originating PR in the [dotnet/aspire](https://github.com/dotnet/aspire) repository. Please review the draft PR once Copilot has completed its work. - `; + commentBody += '### ๐Ÿ“‹ SME Review Required\n\n'; + commentBody += `@${smeUsername} - You have been identified as the subject matter expert (SME) for this documentation update based on the originating PR in the [dotnet/aspire](https://github.com/dotnet/aspire) repository. Please review the draft PR once Copilot has completed its work.\n`; } else { - commentBody += `### โš ๏ธ SME Not Found - - Could not automatically identify the SME from the issue body. Please manually tag the appropriate reviewer once the draft PR is created. - `; + commentBody += '### โš ๏ธ SME Not Found\n\n'; + commentBody += 'Could not automatically identify the SME from the issue body. Please manually tag the appropriate reviewer once the draft PR is created.\n'; } - commentBody += ` - --- - *This comment was automatically generated by the docs-from-code workflow.*`; + commentBody += '\n---\n*This comment was automatically generated by the docs-from-code workflow.*'; await github.rest.issues.createComment({ owner: context.repo.owner, From b08008c1bf6da679fe45109f44f7a2d4e949d668 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 12 Jan 2026 16:07:11 +0000 Subject: [PATCH 4/5] Refine condition check and simplify redundant logic Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --- .github/workflows/docs-from-code.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs-from-code.yml b/.github/workflows/docs-from-code.yml index f588eaa4..5411f299 100644 --- a/.github/workflows/docs-from-code.yml +++ b/.github/workflows/docs-from-code.yml @@ -12,7 +12,7 @@ jobs: assign-to-copilot: name: Assign to Copilot Agent runs-on: ubuntu-latest - if: github.event.label.name == 'docs-from-code' + if: github.event.action == 'labeled' && github.event.label.name == 'docs-from-code' steps: - name: Checkout repository @@ -101,7 +101,7 @@ jobs: let commentBody = '## ๐Ÿค– Copilot Agent Assigned\n\n'; commentBody += 'This issue has been assigned to GitHub Copilot to draft a pull request based on the description provided.\n\n'; - if (smeFound && smeUsername) { + if (smeFound) { commentBody += '### ๐Ÿ“‹ SME Review Required\n\n'; commentBody += `@${smeUsername} - You have been identified as the subject matter expert (SME) for this documentation update based on the originating PR in the [dotnet/aspire](https://github.com/dotnet/aspire) repository. Please review the draft PR once Copilot has completed its work.\n`; } else { From fbaf10427a38045d659a8c929725f3a997fe7e69 Mon Sep 17 00:00:00 2001 From: David Pine Date: Mon, 12 Jan 2026 14:35:29 -0600 Subject: [PATCH 5/5] Update .github/workflows/docs-from-code.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sรฉbastien Ros --- .github/workflows/docs-from-code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs-from-code.yml b/.github/workflows/docs-from-code.yml index 5411f299..1e8b89a9 100644 --- a/.github/workflows/docs-from-code.yml +++ b/.github/workflows/docs-from-code.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Extract SME from issue body id: extract-sme