|
13 | 13 | AWAITING_RESPONSE: stat:awaiting response |
14 | 14 |
|
15 | 15 | jobs: |
16 | | - setup: |
17 | | - name: Calculate Labels |
| 16 | + auto_label: |
| 17 | + name: Calculate and update issue labels |
18 | 18 | if: ${{ !github.event.issue.pull_request }} && ${{ github.event.issue.state == 'open' }} |
19 | 19 | runs-on: ubuntu-latest |
20 | | - outputs: |
21 | | - add_labels: ${{ steps.data.outputs.add_labels }} |
22 | | - remove_labels: ${{ steps.data.outputs.remove_labels }} |
| 20 | + permissions: |
| 21 | + issues: write |
23 | 22 |
|
24 | 23 | steps: |
25 | | - - name: Calculate Labels |
26 | | - id: data |
| 24 | + - name: Calculate labels |
27 | 25 | run: | |
28 | 26 | ADD_LABELS=() |
29 | 27 | REMOVE_LABELS=() |
30 | 28 |
|
31 | 29 | if [[ "${{ github.event.comment.author_association }}" == "MEMBER" ]]; then |
32 | | - ADD_LABELS+=${{ env.AWAITING_RESPONSE}} |
| 30 | + ADD_LABELS+="${{ env.AWAITING_RESPONSE}}" |
33 | 31 | else |
34 | | - REMOVE_LABELS+=${{ env.AWAITING_RESPONSE}} |
| 32 | + REMOVE_LABELS+="${{ env.AWAITING_RESPONSE}}" |
35 | 33 | fi |
36 | 34 |
|
37 | | - echo "add_labels=$(IFS=,; echo "${ADD_LABELS[*]}")" >> $GITHUB_OUTPUT |
38 | | - echo "remove_labels=$(IFS=,; echo "${REMOVE_LABELS[*]}")" >> $GITHUB_OUTPUT |
39 | 35 |
|
40 | | - manage_labels: |
41 | | - runs-on: ubuntu-latest |
42 | | - permissions: |
43 | | - issues: write |
44 | | - needs: [setup] |
45 | | - steps: |
46 | | - - name: Calculate add labels |
47 | | - id: add_labels |
48 | | - if: ${{ needs.setup.outputs.add_labels != '' }} |
49 | | - run: | |
50 | | - COMMAND="" |
51 | | - if [[ -n "${{ needs.setup.outputs.add_labels }}" ]]; then |
52 | | - COMMAND+="--add-label \"${{ needs.setup.outputs.add_labels }}\"" |
53 | | - fi |
54 | | - echo "ADD_LABEL=$COMMAND" >> $GITHUB_ENV |
| 36 | + # Add further label logic here - uses bash |
55 | 37 |
|
56 | | - - name: Calculate remove labels |
57 | | - id: remove_labels |
58 | | - if: ${{ needs.setup.outputs.remove_labels != '' }} |
59 | | - run: | |
60 | | - COMMAND="" |
61 | | - if [[ -n "${{ needs.setup.outputs.remove_labels }}" ]]; then |
62 | | - COMMAND+="--remove-label \"${{ needs.setup.outputs.remove_labels }}\"" |
63 | | - fi |
64 | | - echo "REMOVE_LABEL=$COMMAND" >> $GITHUB_ENV |
| 38 | + echo "ADD_LABELS=$(IFS=,; echo "${ADD_LABELS[*]}")" >> $GITHUB_ENV |
| 39 | + echo "REMOVE_LABELS=$(IFS=,; echo "${REMOVE_LABELS[*]}")" >> $GITHUB_ENV |
65 | 40 |
|
66 | | - - name: Test Print Command |
67 | | - run: | |
68 | | - echo "gh issue edit "$NUMBER" $ADD_LABEL $REMOVE_LABEL" |
| 41 | + - name: Update labels |
| 42 | + run: gh issue edit "$NUMBER" --add-label "$ADD_LABELS" --remove-label "$REMOVE_LABELS" |
69 | 43 | env: |
| 44 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + GH_REPO: ${{ github.repository }} |
70 | 46 | NUMBER: ${{ github.event.issue.number }} |
71 | | - |
72 | | - |
73 | | - # - run: gh issue edit "$NUMBER" --add-label "$ADD_LABELS" --remove-label "$REMOVE_LABELS" |
74 | | - # env: |
75 | | - # GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
76 | | - # GH_REPO: ${{ github.repository }} |
77 | | - # NUMBER: ${{ github.event.issue.number }} |
78 | | - # ADD_LABELS: ${{ needs.setup.outputs.add_labels }} |
79 | | - # REMOVE_LABELS: ${{ needs.setup.outputs.remove_labels }} |
0 commit comments