Skip to content

feature/add balance item info to balance details #56

feature/add balance item info to balance details

feature/add balance item info to balance details #56

Workflow file for this run

name: Clickup Automation
on:
push:
branches-ignore: [ master, develop, main ]
pull_request:
types: [ review_requested, review_request_removed, closed ]
pull_request_review:
types: [ submitted, edited ]
jobs:
clickup-tasks-transition:
name: clickup-automation
runs-on: ubuntu-latest
if: contains(github.event.pull_request.head.ref, 'feature') || contains(github.event.pull_request.head.ref, 'bug') || contains(github.ref, 'feature') || contains(github.ref, 'bug')
steps:
- name: Extract branch name
shell: bash
id: find-task-id-from-branch
run: |
echo "##[set-output name=task-id;]$(echo ${GITHUB_REF#refs/heads/} | sed -E 's/.*\/([^\-]*)(-[0-9]*)([\-\_]*.*)/\1\2/')"
- name: Find in head branch (if pull_request)
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_review'}}
id: find-task-id-from-pr
run: |
echo "::set-output name=task-id::$(echo '${{ github.event.pull_request.head.ref }}' | sed -E 's/.*\/([^\-]*)(-[0-9]*)([\-\_]*.*)/\1\2/')"
- name: Transition to In Progress
if: ${{ github.event_name == 'push' }}
run: |
curl -X PUT \
--url 'https://api.clickup.com/api/v2/task/${{ steps.find-task-id-from-branch.outputs.task-id }}?custom_task_ids=true&team_id=${{ secrets.CU_TEAM_ID}}' \
--header 'Authorization: ${{ secrets.CU_ACCESS_TOKEN }}' \
--header 'Content-Type: application/json' \
--data '{ "status": "In Progress"}'
- name: Transition to Changes Requested
if: ${{ github.event_name == 'pull_request_review' && github.event.review.state != 'approved' }}
run: |
curl -X PUT \
--url 'https://api.clickup.com/api/v2/task/${{ steps.find-task-id-from-pr.outputs.task-id }}?custom_task_ids=true&team_id=${{ secrets.CU_TEAM_ID}}' \
--header 'Authorization: ${{ secrets.CU_ACCESS_TOKEN }}' \
--header 'Content-Type: application/json' \
--data '{ "status": "Changes Requested"}'
- name: Transition to Approved
if: ${{ github.event_name == 'pull_request_review' && github.event.review.state == 'approved' }}
run: |
curl -X PUT \
--url 'https://api.clickup.com/api/v2/task/${{ steps.find-task-id-from-pr.outputs.task-id }}?custom_task_ids=true&team_id=${{ secrets.CU_TEAM_ID}}' \
--header 'Authorization: ${{ secrets.CU_ACCESS_TOKEN }}' \
--header 'Content-Type: application/json' \
--data '{ "status": "Approved"}'
- name: Transition to Ready for Review
if: ${{ github.event_name == 'pull_request' && github.event.action == 'review_requested' }}
run: |
curl -X PUT \
--url 'https://api.clickup.com/api/v2/task/${{ steps.find-task-id-from-pr.outputs.task-id }}?custom_task_ids=true&team_id=${{ secrets.CU_TEAM_ID}}' \
--header 'Authorization: ${{ secrets.CU_ACCESS_TOKEN }}' \
--header 'Content-Type: application/json' \
--data '{ "status": "Ready for Review"}'
- name: Transition to Ready for Testing
if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true }}
run: |
curl -X PUT \
--url 'https://api.clickup.com/api/v2/task/${{ steps.find-task-id-from-pr.outputs.task-id }}?custom_task_ids=true&team_id=${{ secrets.CU_TEAM_ID}}' \
--header 'Authorization: ${{ secrets.CU_ACCESS_TOKEN }}' \
--header 'Content-Type: application/json' \
--data '{ "status": "Ready for Testing"}'
- name: Transition to To Do
if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == false }}
run: |
curl -X PUT \
--url 'https://api.clickup.com/api/v2/task/${{ steps.find-task-id-from-pr.outputs.task-id }}?custom_task_ids=true&team_id=${{ secrets.CU_TEAM_ID}}' \
--header 'Authorization: ${{ secrets.CU_ACCESS_TOKEN }}' \
--header 'Content-Type: application/json' \
--data '{ "status": "To Do"}'