Skip to content

Commit

Permalink
Update Issue Automation (hugo-toha#454)
Browse files Browse the repository at this point in the history
* Update Issue Automation

Signed-off-by: hossainemruz <[email protected]>

* Add connected event

Signed-off-by: hossainemruz <[email protected]>

* Update workflow

Signed-off-by: hossainemruz <[email protected]>

* Update workflows

Signed-off-by: hossainemruz <[email protected]>

* Update workflow

Signed-off-by: hossainemruz <[email protected]>

* Update workflow

Signed-off-by: hossainemruz <[email protected]>
  • Loading branch information
hossainemruz committed Nov 1, 2021
1 parent b28d8e9 commit 0d1bd1f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 6 deletions.
43 changes: 41 additions & 2 deletions .github/workflows/project-automation-issue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
- closed
- labeled
- unlabeled
- connected
jobs:
issue_automation:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
7 changes: 3 additions & 4 deletions .github/workflows/project-automation-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ on:
- closed
- labeled
- unlabeled

jobs:
track_pr:
pr_automation:
runs-on: ubuntu-latest
steps:
- name: Get project data
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0d1bd1f

Please sign in to comment.