From db741952c6f5a350e3250af573c14f3cc29290e4 Mon Sep 17 00:00:00 2001 From: hossainemruz Date: Fri, 5 Nov 2021 02:52:04 +0600 Subject: [PATCH] Update workflow Signed-off-by: hossainemruz --- .github/workflows/project-automation-pr.yaml | 23 +++++++++++++++++--- test.sh | 7 ------ 2 files changed, 20 insertions(+), 10 deletions(-) delete mode 100755 test.sh diff --git a/.github/workflows/project-automation-pr.yaml b/.github/workflows/project-automation-pr.yaml index 4a3890f..084159c 100644 --- a/.github/workflows/project-automation-pr.yaml +++ b/.github/workflows/project-automation-pr.yaml @@ -181,10 +181,12 @@ jobs: GITHUB_TOKEN: ${{secrets.PROJECT_AUTOMATION}} run: | declare -a issues=(${{ steps.linked_issues.outputs.issues }}) - + + # Loop through the every issues and update their Status to same as the PR Status for i in "${issues[@]}" do - item_id="$(gh api graphql -f query=' + # Find the Issue ID + ISSUE_ID="$(gh api graphql -f query=' query($owner: String!, $name: String!, $issue_number: Int!) { repository(owner: $owner, name: $name) { issue(number: $issue_number) { @@ -193,5 +195,20 @@ jobs: } }' -f owner="${{github.event.pull_request.head.repo.owner.login}}" -f name="${{github.event.pull_request.head.repo.name}}" -F issue_number=$i --jq='.data.repository.issue.id')" - echo "Issue ID: $item_id" + echo "Issue ID: $issue_id" + + # Update the Issue Status + gh api graphql -f query=' + mutation ($project: ID!, $item: ID!, $field: ID!, $status_id: ID!) { + updateProjectNextItemField(input: { + projectId: $project + itemId: $item + fieldId: $field + value: $status_id + }) { + projectNextItem { + id + } + } + }' -f project="$PROJECT_ID" -f item="$ISSUE_ID" -f field="$STATUS_ID" -f status_id="$PR_STATUS" --silent done diff --git a/test.sh b/test.sh deleted file mode 100755 index cf2e377..0000000 --- a/test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -data="455 459" -declare -a issues=($data) -for i in "${issues[@]}" -do - echo "Welcome $i times" -done \ No newline at end of file