Skip to content

Commit 409d96d

Browse files
CodeBlanchreyang
andauthored
[repo] Add-labels workflow fix (#5605)
Co-authored-by: Reiley Yang <[email protected]>
1 parent b8ea807 commit 409d96d

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

.github/workflows/add-labels.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,8 @@ jobs:
1818
- name: Add labels for areas found in bug issue descriptions
1919
shell: pwsh
2020
run: |
21-
$match = [regex]::Match('${{ github.event.issue.body }}', '^[#]+ Area\s*?(area:\w+)')
22-
if ($match.Success -eq $false)
23-
{
24-
Return
25-
}
26-
27-
gh issue edit ${{ github.event.issue.number }} `
28-
--add-label $match.Groups[1].Value
21+
.\build\scripts\add-labels.ps1 -issueNumber $env:ISSUE_NUMBER -issueBody $env:ISSUE_BODY
2922
env:
3023
GH_TOKEN: ${{ github.token }}
24+
ISSUE_NUMBER: ${{ github.event.issue.number }}
25+
ISSUE_BODY: ${{ github.event.issue.body }}

OpenTelemetry.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TagWriter", "TagWriter", "{
338338
src\Shared\TagWriter\TagWriter.cs = src\Shared\TagWriter\TagWriter.cs
339339
EndProjectSection
340340
EndProject
341+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{44982E0D-C8C6-42DC-9F8F-714981F27CE6}"
342+
ProjectSection(SolutionItems) = preProject
343+
build\scripts\add-labels.ps1 = build\scripts\add-labels.ps1
344+
EndProjectSection
345+
EndProject
341346
Global
342347
GlobalSection(SolutionConfigurationPlatforms) = preSolution
343348
Debug|Any CPU = Debug|Any CPU
@@ -649,6 +654,7 @@ Global
649654
{19545B37-8518-4BDD-AD49-00C031FB3C2A} = {3862190B-E2C5-418E-AFDC-DB281FB5C705}
650655
{87A20A76-D524-4AAC-AF92-8725BFED0415} = {A49299FB-C5CD-4E0E-B7E1-B7867BBD67CC}
651656
{993E65E5-E71B-40FD-871C-60A9EBD59724} = {A49299FB-C5CD-4E0E-B7E1-B7867BBD67CC}
657+
{44982E0D-C8C6-42DC-9F8F-714981F27CE6} = {7CB2F02E-03FA-4FFF-89A5-C51F107623FD}
652658
EndGlobalSection
653659
GlobalSection(ExtensibilityGlobals) = postSolution
654660
SolutionGuid = {55639B5C-0770-4A22-AB56-859604650521}

build/scripts/add-labels.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
param(
2+
[Parameter(Mandatory=$true)][int]$issueNumber,
3+
[Parameter(Mandatory=$true)][string]$issueBody
4+
)
5+
6+
$match = [regex]::Match($issueBody, '^[#]+ Area\s*?(area:\w+)')
7+
if ($match.Success -eq $false)
8+
{
9+
Return
10+
}
11+
12+
gh issue edit $issueNumber --add-label $match.Groups[1].Value

0 commit comments

Comments
 (0)