Skip to content

Commit 314c9ed

Browse files
azure-sdkCopilotraych1
authored
Sync eng/common directory with azure-sdk-tools for PR 15134 (#46334)
* Add GitHub Action run link to APIView PR comment Agent-Logs-Url: https://github.com/Azure/azure-sdk-tools/sessions/0a4d8e3c-c96b-4265-905c-5f8918876354 Co-authored-by: raych1 <20296335+raych1@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Ray Chen <raychen@microsoft.com> * Apply suggestion from @raych1 * Apply suggestion from @raych1 * Pass GitHubActionRunUrl via environment variable and use IsNullOrWhiteSpace guard Agent-Logs-Url: https://github.com/Azure/azure-sdk-tools/sessions/61d68e76-9b14-444b-b244-44d770e9a9b2 Co-authored-by: raych1 <20296335+raych1@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: raych1 <20296335+raych1@users.noreply.github.com> Co-authored-by: Ray Chen <raychen@microsoft.com>
1 parent aa80d10 commit 314c9ed

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

eng/common/scripts/Helpers/ApiView-Helpers.ps1

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ function Set-ApiViewCommentForRelatedIssues {
127127
[string]$APIViewHost = "https://apiview.dev",
128128
[ValidateNotNullOrEmpty()]
129129
[Parameter(Mandatory = $true)]
130-
$AuthToken
130+
$AuthToken,
131+
[string]$GitHubActionRunUrl = ""
131132
)
132133
. ${PSScriptRoot}\..\common.ps1
133134
$issuesForCommit = $null
@@ -144,7 +145,7 @@ function Set-ApiViewCommentForRelatedIssues {
144145
}
145146
$issuesForCommit.items | ForEach-Object {
146147
$urlParts = $_.url -split "/"
147-
Set-ApiViewCommentForPR -RepoOwner $urlParts[4] -RepoName $urlParts[5] -PrNumber $urlParts[7] -HeadCommitish $HeadCommitish -APIViewHost $APIViewHost -AuthToken $AuthToken
148+
Set-ApiViewCommentForPR -RepoOwner $urlParts[4] -RepoName $urlParts[5] -PrNumber $urlParts[7] -HeadCommitish $HeadCommitish -APIViewHost $APIViewHost -AuthToken $AuthToken -GitHubActionRunUrl $GitHubActionRunUrl
148149
}
149150
}
150151

@@ -162,7 +163,8 @@ function Set-ApiViewCommentForPR {
162163
[string]$APIViewHost,
163164
[ValidateNotNullOrEmpty()]
164165
[Parameter(Mandatory = $true)]
165-
$AuthToken
166+
$AuthToken,
167+
[string]$GitHubActionRunUrl = ""
166168
)
167169
$repoFullName = "$RepoOwner/$RepoName"
168170
$apiviewEndpoint = "$APIViewHost/api/pullrequests?pullRequestNumber=$PrNumber&repoName=$repoFullName&commitSHA=$HeadCommitish"
@@ -208,6 +210,11 @@ function Set-ApiViewCommentForPR {
208210
}
209211

210212
$commentText += "<!-- Fetch URI: $apiviewEndpoint -->"
213+
if (-not [string]::IsNullOrWhiteSpace($GitHubActionRunUrl)) {
214+
$commentText += ""
215+
$commentText += "---"
216+
$commentText += "Comment generated by [After APIView]($GitHubActionRunUrl) workflow run."
217+
}
211218
$commentText = $commentText -join "`r`n"
212219
$existingComment = $null;
213220
$existingAPIViewComment = $null;

0 commit comments

Comments
 (0)