|
| 1 | +name: 'Tag issue with SDK label' |
| 2 | + |
| 3 | +on: |
| 4 | + issues: |
| 5 | + types: [opened] |
| 6 | + |
| 7 | +jobs: |
| 8 | + add_labels: |
| 9 | + name: Add package label |
| 10 | + runs-on: ubuntu-latest |
| 11 | + if: ${{ !github.event.issue.pull_request }} |
| 12 | + steps: |
| 13 | + - name: Get SDK name from issue body |
| 14 | + # https://github.com/actions-ecosystem/action-regex-match |
| 15 | + uses: actions-ecosystem/action-regex-match@v2 |
| 16 | + id: packageName |
| 17 | + with: |
| 18 | + # Parse used package from issue body |
| 19 | + text: ${{ github.event.issue.body }} |
| 20 | + regex: '### Which SDK documentation are we talking about\?\n\n(.*)\n\n' |
| 21 | + |
| 22 | + - name: Map package to issue label |
| 23 | + # https://github.com/kanga333/variable-mapper |
| 24 | + |
| 25 | + id: packageLabel |
| 26 | + if: steps.packageName.outputs.match != '' |
| 27 | + with: |
| 28 | + key: '${{ steps.packageName.outputs.group1 }}' |
| 29 | + # Note: Since this is handled as a regex, and JSON parse wrangles slashes /, we just use `.` instead |
| 30 | + map: | |
| 31 | + { |
| 32 | + "Android SDK": { |
| 33 | + "label": "Platform: Android" |
| 34 | + }, |
| 35 | + "Apple SDK": { |
| 36 | + "label": "Platform: Cocoa" |
| 37 | + }, |
| 38 | + "Dart SDK": { |
| 39 | + "label": "Platform: Dart" |
| 40 | + }, |
| 41 | + "Elixir SDK": { |
| 42 | + "label": "Platform: Elixir" |
| 43 | + }, |
| 44 | + "Flutter SDK": { |
| 45 | + "label": "Platform: Flutter" |
| 46 | + }, |
| 47 | + "Go SDK": { |
| 48 | + "label": "Platform: Go" |
| 49 | + }, |
| 50 | + "Java SDK": { |
| 51 | + "label": "Platform: Java" |
| 52 | + }, |
| 53 | + "JavaScript SDK": { |
| 54 | + "label": "Platform: JavaScript" |
| 55 | + }, |
| 56 | + "Kotlin Multiplatform SDK": { |
| 57 | + "label": "Platform: KMP" |
| 58 | + }, |
| 59 | + "Native SDK": { |
| 60 | + "label": "Platform: Native" |
| 61 | + }, |
| 62 | + ".NET SDK": { |
| 63 | + "label": "Platform: .NET" |
| 64 | + }, |
| 65 | + "PHP SDK": { |
| 66 | + "label": "Platform: PHP" |
| 67 | + }, |
| 68 | + "PowerShell SDK": { |
| 69 | + "label": "Platform: PowerShell" |
| 70 | + }, |
| 71 | + "Python SDK": { |
| 72 | + "label": "Platform: Python" |
| 73 | + }, |
| 74 | + "React Native SDK": { |
| 75 | + "label": "Platform: React Native" |
| 76 | + }, |
| 77 | + "Ruby SDK": { |
| 78 | + "label": "Platform: Ruby" |
| 79 | + }, |
| 80 | + "Rust SDK": { |
| 81 | + "label": "Platform: Rust" |
| 82 | + }, |
| 83 | + "Unity SDK": { |
| 84 | + "label": "Platform: Unity" |
| 85 | + }, |
| 86 | + "Unreal Engine SDK": { |
| 87 | + "label": "Platform: Unreal" |
| 88 | + }, |
| 89 | + "Sentry CLI": { |
| 90 | + "label": "Platform: CLI" |
| 91 | + }, |
| 92 | + "All JavaScript SDKs": { |
| 93 | + "label": "Team: Web Frontend SDKs" |
| 94 | + }, |
| 95 | + "All Backend SDKs": { |
| 96 | + "label": "Team: Web Backend SDKs" |
| 97 | + }, |
| 98 | + "All Gaming SDKs": { |
| 99 | + "label": "Team: Web Backend SDKs" |
| 100 | + }, |
| 101 | + "All Mobile SDKs": { |
| 102 | + "label": "Team: Mobile Platform" |
| 103 | + }, |
| 104 | + "All SDKs": { |
| 105 | + "label": "Team: SDKs" |
| 106 | + }, |
| 107 | + "Other": { |
| 108 | + "label": "Team: SDKs" |
| 109 | + }, |
| 110 | + } |
| 111 | + export_to: output |
| 112 | + |
| 113 | + - name: Add package label if applicable |
| 114 | + # Note: We only add the label if the issue is still open |
| 115 | + if: steps.packageLabel.outputs.label != '' |
| 116 | + uses: actions-ecosystem/action-add-labels@v1 |
| 117 | + with: |
| 118 | + labels: ${{ steps.packageLabel.outputs.label }} |
0 commit comments