diff --git a/.github/workflows/project-automation-issue.yaml b/.github/workflows/project-automation-issue.yaml index 91db25d..dfa5a39 100644 --- a/.github/workflows/project-automation-issue.yaml +++ b/.github/workflows/project-automation-issue.yaml @@ -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'))<> $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 diff --git a/.github/workflows/project-automation-pr.yaml b/.github/workflows/project-automation-pr.yaml index 9b65697..01ce933 100644 --- a/.github/workflows/project-automation-pr.yaml +++ b/.github/workflows/project-automation-pr.yaml @@ -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'))<> $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