|
| 1 | +# Manage issues in a project board using https://github.com/leonsteinhaeuser/project-beta-automations |
| 2 | + |
| 3 | +--- |
| 4 | +name: Kanban |
| 5 | +on: |
| 6 | + pull_request_target: |
| 7 | + issues: |
| 8 | + types: |
| 9 | + - labeled |
| 10 | + - reopened |
| 11 | + - assigned |
| 12 | + - closed |
| 13 | + |
| 14 | +env: |
| 15 | + free_to_take: Free to take |
| 16 | + in_progress: In Progress |
| 17 | + needs_review: Needs review |
| 18 | + done: Done |
| 19 | + |
| 20 | +jobs: |
| 21 | + # only prio-list labeled items should be added to the board |
| 22 | + add-to-project-board: |
| 23 | + if: github.event_name == 'issues' && contains(github.event.issue.labels.*.name, 'prio-list') && contains(fromJson('["labeled", "reopened"]'), github.event.action) |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - name: Add issue to Free-to-take list |
| 27 | + uses: leonsteinhaeuser/[email protected] |
| 28 | + with: |
| 29 | + gh_token: ${{ secrets.RELEASE_TOKEN }} |
| 30 | + organization: pulp |
| 31 | + project_id: 8 |
| 32 | + resource_node_id: ${{ github.event.issue.node_id }} |
| 33 | + operation_mode: status |
| 34 | + status_value: ${{ env.free_to_take }} # Target status |
| 35 | + |
| 36 | + move-to-inprogress: |
| 37 | + if: github.event_name == 'issues' && github.event.action == 'assigned' |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - name: Move an issue to the In Progress column |
| 41 | + uses: leonsteinhaeuser/[email protected] |
| 42 | + with: |
| 43 | + gh_token: ${{ secrets.RELEASE_TOKEN }} |
| 44 | + organization: pulp |
| 45 | + project_id: 8 |
| 46 | + resource_node_id: ${{ github.event.issue.node_id }} |
| 47 | + operation_mode: status |
| 48 | + status_value: ${{ env.in_progress }} # Target status |
| 49 | + |
| 50 | + find-linked-issues: |
| 51 | + if: github.event_name == 'pull_request_target' |
| 52 | + runs-on: ubuntu-latest |
| 53 | + name: Find issues linked to a PR |
| 54 | + outputs: |
| 55 | + linked-issues: ${{ steps.linked-issues.outputs.issues }} |
| 56 | + steps: |
| 57 | + - name: Checkout |
| 58 | + uses: actions/checkout@v2 |
| 59 | + - name: Get Linked Issues Action |
| 60 | + |
| 61 | + id: linked-issues |
| 62 | + with: |
| 63 | + access-token: ${{ secrets.RELEASE_TOKEN }} |
| 64 | + |
| 65 | + move-to-needs-review: |
| 66 | + if: github.event_name == 'pull_request_target' && contains(fromJson(needs.find-linked-issues.outputs.linked-issues).*.issue.state, 'open') |
| 67 | + runs-on: ubuntu-latest |
| 68 | + name: Move linked issues to Needs Review |
| 69 | + needs: find-linked-issues |
| 70 | + strategy: |
| 71 | + max-parallel: 3 |
| 72 | + matrix: |
| 73 | + issues: ${{ fromJSON(needs.find-linked-issues.outputs.linked-issues) }} |
| 74 | + steps: |
| 75 | + - name: Move to Needs Review |
| 76 | + uses: leonsteinhaeuser/[email protected] |
| 77 | + with: |
| 78 | + gh_token: ${{ secrets.RELEASE_TOKEN }} |
| 79 | + organization: pulp |
| 80 | + project_id: 8 |
| 81 | + resource_node_id: ${{ matrix.issues.issue.node_id }} |
| 82 | + operation_mode: status |
| 83 | + status_value: ${{ env.needs_review }} # Target status |
| 84 | + |
| 85 | + move-to-done: |
| 86 | + if: github.event_name == 'issues' && github.event.action == 'closed' |
| 87 | + runs-on: ubuntu-latest |
| 88 | + steps: |
| 89 | + - name: Move an issue to the Done column |
| 90 | + uses: leonsteinhaeuser/[email protected] |
| 91 | + with: |
| 92 | + gh_token: ${{ secrets.RELEASE_TOKEN }} |
| 93 | + organization: pulp |
| 94 | + project_id: 8 |
| 95 | + resource_node_id: ${{ github.event.issue.node_id }} |
| 96 | + operation_mode: status |
| 97 | + status_value: ${{ env.done }} # Target status |
0 commit comments