From 5cd5c17f3885412a2b661929177459ed50aa02a4 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Mon, 8 Jan 2024 16:55:12 -0500 Subject: [PATCH 1/2] Add workflow to update issue and PR status on GH project board Signed-off-by: Timothy Johnson --- .github/workflows/update-project.yml | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/update-project.yml diff --git a/.github/workflows/update-project.yml b/.github/workflows/update-project.yml new file mode 100644 index 0000000..c6da6c4 --- /dev/null +++ b/.github/workflows/update-project.yml @@ -0,0 +1,51 @@ +name: Update GitHub Project + +on: + issues: + types: [labeled] + pull_request_target: + types: [opened, reopened, converted_to_draft, ready_for_review] + +env: + PROJECT_NUMBER: 21 + +jobs: + update-project: + name: Move project item + runs-on: ubuntu-latest + steps: + - uses: zowe-actions/shared-actions/project-move-item@main + if: ${{ github.event.pull_request }} + with: + assign-author: true + item-status: ${{ github.event.action == 'ready_for_review' && 'Review/QA' || 'In Progress' }} + project-number: ${{ env.PROJECT_NUMBER }} + project-token: ${{ secrets.ZOWE_ROBOT_TOKEN }} + + - uses: zowe-actions/shared-actions/project-move-item@main + if: ${{ github.event.issue && github.event.label.name == 'priority-high' }} + with: + item-status: High Priority + project-number: ${{ env.PROJECT_NUMBER }} + project-token: ${{ secrets.ZOWE_ROBOT_TOKEN }} + + - uses: zowe-actions/shared-actions/project-move-item@main + if: ${{ github.event.issue && github.event.label.name == 'priority-medium' }} + with: + item-status: Medium Priority + project-number: ${{ env.PROJECT_NUMBER }} + project-token: ${{ secrets.ZOWE_ROBOT_TOKEN }} + + - uses: zowe-actions/shared-actions/project-move-item@main + if: ${{ github.event.issue && github.event.label.name == 'priority-low' }} + with: + item-status: Low Priority + project-number: ${{ env.PROJECT_NUMBER }} + project-token: ${{ secrets.ZOWE_ROBOT_TOKEN }} + + - uses: zowe-actions/shared-actions/project-move-item@main + if: ${{ github.event.issue && github.event.label.name == 'Epic' }} + with: + item-status: Epics + project-number: ${{ env.PROJECT_NUMBER }} + project-token: ${{ secrets.ZOWE_ROBOT_TOKEN }} From 37ee85054b8a5cc11c4ebdd3c1ae70fd0c5b3f7d Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Tue, 9 Jan 2024 09:43:51 -0500 Subject: [PATCH 2/2] Update workflow to simplify steps Signed-off-by: Timothy Johnson --- .github/workflows/update-project.yml | 34 +++++++--------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/.github/workflows/update-project.yml b/.github/workflows/update-project.yml index c6da6c4..6694587 100644 --- a/.github/workflows/update-project.yml +++ b/.github/workflows/update-project.yml @@ -8,6 +8,9 @@ on: env: PROJECT_NUMBER: 21 + ISSUE_STATUSES: '{"priority-high": "High Priority", "priority-medium": "Medium Priority", "priority-low": "Low Priority", "Epic": "Epics"}' + PR_STATUS_DRAFT: 'In Progress' + PR_STATUS_READY: 'Review/QA' jobs: update-project: @@ -15,37 +18,16 @@ jobs: runs-on: ubuntu-latest steps: - uses: zowe-actions/shared-actions/project-move-item@main - if: ${{ github.event.pull_request }} - with: - assign-author: true - item-status: ${{ github.event.action == 'ready_for_review' && 'Review/QA' || 'In Progress' }} - project-number: ${{ env.PROJECT_NUMBER }} - project-token: ${{ secrets.ZOWE_ROBOT_TOKEN }} - - - uses: zowe-actions/shared-actions/project-move-item@main - if: ${{ github.event.issue && github.event.label.name == 'priority-high' }} + if: ${{ github.event.issue && fromJSON(env.ISSUE_STATUSES)[github.event.label.name] }} with: - item-status: High Priority + item-status: ${{ fromJSON(env.ISSUE_STATUSES)[github.event.label.name] }} project-number: ${{ env.PROJECT_NUMBER }} project-token: ${{ secrets.ZOWE_ROBOT_TOKEN }} - uses: zowe-actions/shared-actions/project-move-item@main - if: ${{ github.event.issue && github.event.label.name == 'priority-medium' }} - with: - item-status: Medium Priority - project-number: ${{ env.PROJECT_NUMBER }} - project-token: ${{ secrets.ZOWE_ROBOT_TOKEN }} - - - uses: zowe-actions/shared-actions/project-move-item@main - if: ${{ github.event.issue && github.event.label.name == 'priority-low' }} - with: - item-status: Low Priority - project-number: ${{ env.PROJECT_NUMBER }} - project-token: ${{ secrets.ZOWE_ROBOT_TOKEN }} - - - uses: zowe-actions/shared-actions/project-move-item@main - if: ${{ github.event.issue && github.event.label.name == 'Epic' }} + if: ${{ github.event.pull_request }} with: - item-status: Epics + assign-author: true + item-status: ${{ github.event.action == 'ready_for_review' && env.PR_STATUS_READY || env.PR_STATUS_DRAFT }} project-number: ${{ env.PROJECT_NUMBER }} project-token: ${{ secrets.ZOWE_ROBOT_TOKEN }}