diff --git a/.github/workflows/add-labels.yml b/.github/workflows/add-labels.yml index 376c891bb7..3566af9ec8 100644 --- a/.github/workflows/add-labels.yml +++ b/.github/workflows/add-labels.yml @@ -18,13 +18,8 @@ jobs: - name: Add labels for areas found in bug issue descriptions shell: pwsh run: | - $match = [regex]::Match('${{ github.event.issue.body }}', '^[#]+ Area\s*?(area:\w+)') - if ($match.Success -eq $false) - { - Return - } - - gh issue edit ${{ github.event.issue.number }} ` - --add-label $match.Groups[1].Value + .\build\scripts\add-labels.ps1 -issueNumber $env:ISSUE_NUMBER -issueBody $env:ISSUE_BODY env: GH_TOKEN: ${{ github.token }} + ISSUE_NUMBER: ${{ github.event.issue.number }} + ISSUE_BODY: ${{ github.event.issue.body }} diff --git a/OpenTelemetry.sln b/OpenTelemetry.sln index 203a7d12a3..2808bd5f00 100644 --- a/OpenTelemetry.sln +++ b/OpenTelemetry.sln @@ -338,6 +338,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TagWriter", "TagWriter", "{ src\Shared\TagWriter\TagWriter.cs = src\Shared\TagWriter\TagWriter.cs EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{44982E0D-C8C6-42DC-9F8F-714981F27CE6}" + ProjectSection(SolutionItems) = preProject + build\scripts\add-labels.ps1 = build\scripts\add-labels.ps1 + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -649,6 +654,7 @@ Global {19545B37-8518-4BDD-AD49-00C031FB3C2A} = {3862190B-E2C5-418E-AFDC-DB281FB5C705} {87A20A76-D524-4AAC-AF92-8725BFED0415} = {A49299FB-C5CD-4E0E-B7E1-B7867BBD67CC} {993E65E5-E71B-40FD-871C-60A9EBD59724} = {A49299FB-C5CD-4E0E-B7E1-B7867BBD67CC} + {44982E0D-C8C6-42DC-9F8F-714981F27CE6} = {7CB2F02E-03FA-4FFF-89A5-C51F107623FD} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {55639B5C-0770-4A22-AB56-859604650521} diff --git a/build/scripts/add-labels.ps1 b/build/scripts/add-labels.ps1 new file mode 100644 index 0000000000..1a2c23539a --- /dev/null +++ b/build/scripts/add-labels.ps1 @@ -0,0 +1,12 @@ +param( + [Parameter(Mandatory=$true)][int]$issueNumber, + [Parameter(Mandatory=$true)][string]$issueBody +) + +$match = [regex]::Match($issueBody, '^[#]+ Area\s*?(area:\w+)') +if ($match.Success -eq $false) +{ + Return +} + +gh issue edit $issueNumber --add-label $match.Groups[1].Value