|
1 | | -name: first-issues-to-beginner-issues-project |
| 1 | +name: issue-to-project-board-workflow |
2 | 2 | on: |
3 | 3 | # Trigger when an issue gets labeled or deleted |
4 | 4 | issues: |
5 | 5 | types: [reopened, closed, labeled, unlabeled, assigned, unassigned] |
6 | 6 |
|
7 | 7 | jobs: |
8 | | - manage_project_issues: |
9 | | - strategy: |
10 | | - fail-fast: false |
11 | | - matrix: |
12 | | - project: |
13 | | - - 'Beginner Issues' |
| 8 | + setup_matrix_input: |
14 | 9 | runs-on: ubuntu-latest |
15 | | - if: contains(github.event.issue.labels.*.name, 'good first issue') |
16 | | - steps: |
17 | | - # When an issue that is open is labeled, unassigned or reopened without a assigned member |
18 | | - # create or move the card to "To do" |
19 | | - - name: Create or Update Project Card |
20 | | - if: | |
21 | | - github.event.action == 'labeled' || |
22 | | - github.event.action == 'reopened' || |
23 | | - github.event.action == 'unassigned' |
24 | | - uses: alex-page/github-project-automation-plus@v0.8.1 |
25 | | - with: |
26 | | - project: ${{ matrix.project }} |
27 | | - column: 'To do' |
28 | | - repo-token: ${{ secrets.PROJECT_BOARD_AUTOMATION_PAT }} |
29 | | - |
30 | | - # When an issue that is open is assigned and has an assigned member |
31 | | - # create or move the card to "In progress" |
32 | | - - name: Assign Project Card |
33 | | - if: | |
34 | | - github.event.action == 'assigned' |
35 | | - uses: alex-page/github-project-automation-plus@v0.8.1 |
36 | | - with: |
37 | | - project: ${{ matrix.project }} |
38 | | - column: 'In progress' |
39 | | - repo-token: ${{ secrets.PROJECT_BOARD_AUTOMATION_PAT }} |
40 | 10 |
|
41 | | - # When an issue is closed with the good first issue tag |
42 | | - # Create or move the card to "Done" |
43 | | - - name: Close Project Card |
44 | | - if: | |
45 | | - github.event.action == 'closed' |
46 | | - uses: asmfnk/my-github-project-automation@v0.5.0 |
47 | | - with: |
48 | | - project: ${{ matrix.project }} |
49 | | - column: 'Done' |
50 | | - repo-token: ${{ secrets.PROJECT_BOARD_AUTOMATION_PAT }} |
51 | | - |
52 | | - remove_project_issues: |
53 | | - strategy: |
54 | | - fail-fast: false |
55 | | - matrix: |
56 | | - project: |
57 | | - - 'Beginner Issues' |
58 | | - runs-on: ubuntu-latest |
59 | | - if: ${{ !contains(github.event.issue.labels.*.name, 'good first issue') }} |
60 | 11 | steps: |
61 | | - # When an issue has the tag 'good first issue' removed |
62 | | - # Remove the card from the board |
63 | | - - name: Remove Project Card |
64 | | - if: | |
65 | | - github.event.action == 'unlabeled' |
66 | | - uses: alex-page/github-project-automation-plus@v0.8.1 |
67 | | - with: |
68 | | - project: ${{ matrix.project }} |
69 | | - column: 'To do' |
70 | | - repo-token: ${{ secrets.PROJECT_BOARD_AUTOMATION_PAT }} |
71 | | - action: delete |
| 12 | + - id: set-matrix |
| 13 | + run: | |
| 14 | + output=$(curl ${{ github.event.issue.url }}/labels | jq '.[] | .name') |
72 | 15 | |
| 16 | + echo '======================' |
| 17 | + echo 'Process incoming data' |
| 18 | + echo '======================' |
| 19 | + json=$(echo $output | sed 's/"\s"/","/g') |
| 20 | + echo $json |
| 21 | + echo "::set-output name=matrix::$(echo $json)" |
| 22 | + outputs: |
| 23 | + issueTags: ${{ steps.set-matrix.outputs.matrix }} |
| 24 | + |
| 25 | + Manage_project_issues: |
| 26 | + needs: setup_matrix_input |
| 27 | + uses: vapor/ci/.github/workflows/issues-to-project-board.yml@main |
| 28 | + with: |
| 29 | + labelsJson: ${{ needs.setup_matrix_input.outputs.issueTags }} |
| 30 | + secrets: |
| 31 | + PROJECT_BOARD_AUTOMATION_PAT: "${{ secrets.PROJECT_BOARD_AUTOMATION_PAT }}" |
0 commit comments