From ee22eff316ac63618153c223c5dc8eb82bd9e061 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Sun, 2 Apr 2023 23:04:17 +0200 Subject: [PATCH] project action > changes requested CU task In progress --- .github/workflows/project_actions.yml | 44 +++++++++++++++++++-------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/.github/workflows/project_actions.yml b/.github/workflows/project_actions.yml index 8ee869be93..6e56f125ea 100644 --- a/.github/workflows/project_actions.yml +++ b/.github/workflows/project_actions.yml @@ -11,6 +11,7 @@ on: types: [created] jobs: + pr_review_started: name: pr_review_started runs-on: ubuntu-latest @@ -34,19 +35,36 @@ jobs: resource_node_id: ${{ github.event.pull_request.node_id || github.event.issue.node_id }} status_value: Review In Progress - # pr_review_requested: - # name: pr_review_requested - # runs-on: ubuntu-latest - # if: github.event_name == 'pull_request_review' && github.event.review.state == 'changes_requested' - # steps: - # - name: Move PR to 'Change Requested' - # uses: leonsteinhaeuser/project-beta-automations@v2.1.0 - # with: - # gh_token: ${{ secrets.YNPUT_BOT_TOKEN }} - # organization: ynput - # project_id: 11 - # resource_node_id: ${{ github.event.pull_request.node_id }} - # status_value: Change Requested + pr_review_requested: + # ----------------------------- + # Resets Clickup Task status to 'In Progress' after 'Changes Requested' were submitted to PR + # It only runs if custom clickup task id was found in ref branch of PR + # ----------------------------- + name: pr_review_requested + runs-on: ubuntu-latest + if: github.event_name == 'pull_request_review' && github.event.review.state == 'changes_requested' + steps: + - name: Set branch env + run: echo "BRANCH_NAME=${{ github.event.pull_request.head.ref}}" >> $GITHUB_ENV + - name: Get ClickUp ID from ref head name + id: get_cuID + run: | + echo ${{ env.BRANCH_NAME }} + echo "cuID=$(echo $BRANCH_NAME | sed 's/.*\/\(OP\-[0-9]\{4\}\).*/\1/')" >> $GITHUB_OUTPUT + + - name: Print ClickUp ID + run: echo ${{ steps.get_cuID.outputs.cuID }} + + - name: Move found Clickup task to 'Review in Progress' + if: steps.get_cuID.outputs.cuID + run: | + curl -i -X PUT \ + 'https://api.clickup.com/api/v2/task/${{ steps.get_cuID.outputs.cuID }}?custom_task_ids=true&team_id=${{secrets.CLICKUP_TEAM_ID}}' \ + -H 'Authorization: ${{secrets.CLICKUP_API_KEY}}' \ + -H 'Content-Type: application/json' \ + -d '{ + "status": "in progress" + }' size-label: name: pr_size_label