Skip to content

Commit

Permalink
chore: add workflow to automatically label issues
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanie-anderson authored Sep 6, 2024
1 parent 33c30d6 commit 8c7af2f
Showing 1 changed file with 118 additions and 0 deletions.
118 changes: 118 additions & 0 deletions .github/workflows/issue-sdk-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: 'Tag issue with SDK label'

on:
issues:
types: [opened]

jobs:
add_labels:
name: Add package label
runs-on: ubuntu-latest
if: ${{ !github.event.issue.pull_request }}
steps:
- name: Get SDK name from issue body
# https://github.com/actions-ecosystem/action-regex-match
uses: actions-ecosystem/action-regex-match@v2
id: packageName
with:
# Parse used package from issue body
text: ${{ github.event.issue.body }}
regex: '### Which SDK documentation are we talking about\?\n\n(.*)\n\n'

- name: Map package to issue label
# https://github.com/kanga333/variable-mapper
uses: kanga333/[email protected]
id: packageLabel
if: steps.packageName.outputs.match != ''
with:
key: '${{ steps.packageName.outputs.group1 }}'
# Note: Since this is handled as a regex, and JSON parse wrangles slashes /, we just use `.` instead
map: |
{
"Android SDK": {
"label": "Platform: Android"
},
"Apple SDK": {
"label": "Platform: Cocoa"
},
"Dart SDK": {
"label": "Platform: Dart"
},
"Elixir SDK": {
"label": "Platform: Elixir"
},
"Flutter SDK": {
"label": "Platform: Flutter"
},
"Go SDK": {
"label": "Platform: Go"
},
"Java SDK": {
"label": "Platform: Java"
},
"JavaScript SDK": {
"label": "Platform: JavaScript"
},
"Kotlin Multiplatform SDK": {
"label": "Platform: KMP"
},
"Native SDK": {
"label": "Platform: Native"
},
".NET SDK": {
"label": "Platform: .NET"
},
"PHP SDK": {
"label": "Platform: PHP"
},
"PowerShell SDK": {
"label": "Platform: PowerShell"
},
"Python SDK": {
"label": "Platform: Python"
},
"React Native SDK": {
"label": "Platform: React Native"
},
"Ruby SDK": {
"label": "Platform: Ruby"
},
"Rust SDK": {
"label": "Platform: Rust"
},
"Unity SDK": {
"label": "Platform: Unity"
},
"Unreal Engine SDK": {
"label": "Platform: Unreal"
},
"Sentry CLI": {
"label": "Platform: CLI"
},
"All JavaScript SDKs": {
"label": "Team: Web Frontend SDKs"
},
"All Backend SDKs": {
"label": "Team: Web Backend SDKs"
},
"All Gaming SDKs": {
"label": "Team: Web Backend SDKs"
},
"All Mobile SDKs": {
"label": "Team: Mobile Platform"
},
"All SDKs": {
"label": "Team: SDKs"
},
"Other": {
"label": "Team: SDKs"
},
}
export_to: output

- name: Add package label if applicable
# Note: We only add the label if the issue is still open
if: steps.packageLabel.outputs.label != ''
uses: actions-ecosystem/action-add-labels@v1
with:
labels: ${{ steps.packageLabel.outputs.label }}

0 comments on commit 8c7af2f

Please sign in to comment.