Update Issue Automation (#454)

* Update Issue Automation

Signed-off-by: hossainemruz <hossainemruz@gmail.com>

* Add connected event

Signed-off-by: hossainemruz <hossainemruz@gmail.com>

* Update workflow

Signed-off-by: hossainemruz <hossainemruz@gmail.com>

* Update workflows

Signed-off-by: hossainemruz <hossainemruz@gmail.com>

* Update workflow

Signed-off-by: hossainemruz <hossainemruz@gmail.com>

* Update workflow

Signed-off-by: hossainemruz <hossainemruz@gmail.com>
This commit is contained in:
Emruz Hossain 2021-11-02 00:49:36 +06:00 committed by GitHub
parent b28d8e93cf
commit 0d1bd1f9f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 6 deletions

View file

@ -7,7 +7,6 @@ on:
- closed
- labeled
- unlabeled
- connected
jobs:
issue_automation:
runs-on: ubuntu-latest
@ -73,7 +72,7 @@ jobs:
env:
ISSUE_DATA: ${{ toJson(github.event.issue) }}
run: |
echo 'LABELS=($(echo "$ISSUE_DATA" | jq '.labels[]' | jq -r '.name'))<<EOF' >> $GITHUB_ENV
echo 'LABELS='$(echo "$PR_DATA" | jq -r '[.labels[].name] | join(" ")') >> $GITHUB_ENV
- name: Set "Type" field
env:
@ -120,3 +119,43 @@ jobs:
}
}' -f project="$PROJECT_ID" -f item="$ITEM_ID" -f field="$TYPE_ID" -f opt_id="$OPTION_ID" --silent
fi
# - name: Set "Status" field
# env:
# GITHUB_TOKEN: ${{secrets.PROJECT_AUTOMATION}}
# run: |
# MERGED=${{github.event.issue.merged}}
# STATE=${{github.event.issue.state}}
# REVIEWERS=${{github.event.issue.requested_reviewers}}
# DRAFT=${{github.event.issue.draft}}
# echo "Merged: $MERGED"
# echo "State: $STATE"
# echo "Draft: $DRAFT"
# echo "Reviewer: $REVIEWER"
# OPTION_ID=$STATUS_TODO
# if [[ ("${MERGED}" == "true") || ("${STATUS}" == "closed") ]]
# then
# OPTION_ID=$STATUS_DONE
# elif [[ ${#REVIEWERS[@]} -gt 0 ]]
# then
# OPTION_ID=$STATUS_READY_FOR_REVIEW
# else
# OPTION_ID=$STATUS_IN_PROGRESS
# fi
# 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="$ITEM_ID" -f field="$STATUS_ID" -f status_id="$OPTION_ID" --silent

View file

@ -9,9 +9,8 @@ on:
- closed
- labeled
- unlabeled
jobs:
track_pr:
pr_automation:
runs-on: ubuntu-latest
steps:
- name: Get project data
@ -75,7 +74,7 @@ jobs:
env:
PR_DATA: ${{ toJson(github.event.pull_request) }}
run: |
echo 'LABELS=($(echo "$PR_DATA" | jq '.labels[]' | jq -r '.name'))<<EOF' >> $GITHUB_ENV
echo 'LABELS='$(echo "$PR_DATA" | jq -r '[.labels[].name] | join(" ")') >> $GITHUB_ENV
- name: Set "Type" field
env:
@ -143,7 +142,7 @@ jobs:
then
OPTION_ID=$STATUS_DONE
elif [[ ${#REVIEWERS[@]} -gt 0 ]]
then
then
OPTION_ID=$STATUS_READY_FOR_REVIEW
else
OPTION_ID=$STATUS_IN_PROGRESS