|
| 1 | +name: Label Discussions |
| 2 | + |
| 3 | +on: |
| 4 | + discussion: |
| 5 | + types: |
| 6 | + - created |
| 7 | + |
| 8 | +jobs: |
| 9 | + label_discussions: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + permissions: |
| 12 | + discussions: write |
| 13 | + env: |
| 14 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Always add "triage" label |
| 18 | + if: > |
| 19 | + github.event.discussion.node_id != '' && |
| 20 | + (github.event.discussion.category.name == 'General' || |
| 21 | + github.event.discussion.category.name == 'Ideas' || |
| 22 | + github.event.discussion.category.name == 'Q&A') |
| 23 | + |
| 24 | + with: |
| 25 | + query: | |
| 26 | + mutation($labelableId: ID!) { |
| 27 | + addLabelsToLabelable( |
| 28 | + input: { |
| 29 | + labelableId: $labelableId |
| 30 | + labelIds: ["LA_kwDOJDJ_Yc8AAAABU2klmQ"] |
| 31 | + } |
| 32 | + ) { |
| 33 | + clientMutationId |
| 34 | + } |
| 35 | + } |
| 36 | + variables: | |
| 37 | + { |
| 38 | + "labelableId": "${{ github.event.discussion.node_id }}" |
| 39 | + } |
| 40 | +
|
| 41 | + - name: Conditionally add "python" label |
| 42 | + if: > |
| 43 | + github.event.discussion.node_id != '' && |
| 44 | + (github.event.discussion.category.name == 'General' || |
| 45 | + github.event.discussion.category.name == 'Ideas' || |
| 46 | + github.event.discussion.category.name == 'Q&A') && |
| 47 | + (contains(github.event.discussion.body, 'python') || |
| 48 | + contains(github.event.discussion.body, 'Python') || |
| 49 | + contains(github.event.discussion.title, 'python') || |
| 50 | + contains(github.event.discussion.title, 'Python')) |
| 51 | + |
| 52 | + with: |
| 53 | + query: | |
| 54 | + mutation($labelableId: ID!) { |
| 55 | + addLabelsToLabelable( |
| 56 | + input: { |
| 57 | + labelableId: $labelableId |
| 58 | + labelIds: ["LA_kwDOJDJ_Yc8AAAABO0f2Lg"] |
| 59 | + } |
| 60 | + ) { |
| 61 | + clientMutationId |
| 62 | + } |
| 63 | + } |
| 64 | + variables: | |
| 65 | + { |
| 66 | + "labelableId": "${{ github.event.discussion.node_id }}" |
| 67 | + } |
| 68 | +
|
| 69 | + - name: Conditionally add ".NET" label |
| 70 | + if: > |
| 71 | + github.event.discussion.node_id != '' && |
| 72 | + (github.event.discussion.category.name == 'General' || |
| 73 | + github.event.discussion.category.name == 'Ideas' || |
| 74 | + github.event.discussion.category.name == 'Q&A') && |
| 75 | + (contains(github.event.discussion.body, '.net') || |
| 76 | + contains(github.event.discussion.body, '.NET') || |
| 77 | + contains(github.event.discussion.title, '.net') || |
| 78 | + contains(github.event.discussion.title, '.NET') || |
| 79 | + contains(github.event.discussion.body, 'dotnet') || |
| 80 | + contains(github.event.discussion.body, 'DotNet') || |
| 81 | + contains(github.event.discussion.title, 'dotnet') || |
| 82 | + contains(github.event.discussion.title, 'DotNet') || |
| 83 | + contains(github.event.discussion.body, 'c#') || |
| 84 | + contains(github.event.discussion.body, 'C#') || |
| 85 | + contains(github.event.discussion.title, 'c#') || |
| 86 | + contains(github.event.discussion.title, 'C#') || |
| 87 | + contains(github.event.discussion.body, 'csharp') || |
| 88 | + contains(github.event.discussion.body, 'CSharp') || |
| 89 | + contains(github.event.discussion.title, 'csharp') || |
| 90 | + contains(github.event.discussion.title, 'CSharp')) |
| 91 | + |
| 92 | + with: |
| 93 | + query: | |
| 94 | + mutation($labelableId: ID!) { |
| 95 | + addLabelsToLabelable( |
| 96 | + input: { |
| 97 | + labelableId: $labelableId |
| 98 | + labelIds: ["LA_kwDOJDJ_Yc8AAAABN_r7Lw"] |
| 99 | + } |
| 100 | + ) { |
| 101 | + clientMutationId |
| 102 | + } |
| 103 | + } |
| 104 | + variables: | |
| 105 | + { |
| 106 | + "labelableId": "${{ github.event.discussion.node_id }}" |
| 107 | + } |
0 commit comments