Skip to content

[PROJECT] Redesign issue management methodology — epics, stories, sprints, tasks #45

[PROJECT] Redesign issue management methodology — epics, stories, sprints, tasks

[PROJECT] Redesign issue management methodology — epics, stories, sprints, tasks #45

name: Add to Project
on:
issues:
types: [opened, labeled]
pull_request:
types: [opened, labeled]
jobs:
add-to-project:
runs-on: ubuntu-latest
outputs:
item_id: ${{ steps.add.outputs.itemId }}
steps:
- uses: actions/add-to-project@v1.0.2
id: add
with:
project-url: https://github.com/orgs/AzureLocal/projects/3
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
set-fields:
needs: add-to-project
runs-on: ubuntu-latest
if: github.event_name == 'issues' && needs.add-to-project.result == 'success' && needs.add-to-project.outputs.item_id != ''
env:
GH_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ID: "PVT_kwDOCxeiOM4BR2KZ"
SOLUTION_FIELD: "PVTSSF_lADOCxeiOM4BR2KZzg_jXuY"
PRIORITY_FIELD: "PVTSSF_lADOCxeiOM4BR2KZzg_jXvs"
CATEGORY_FIELD: "PVTSSF_lADOCxeiOM4BR2KZzg_jXxA"
ITEM_ID: ${{ needs.add-to-project.outputs.item_id }}
ID_FIELD: "PVTF_lADOCxeiOM4BR2KZzhADImQ"
steps:
- name: Set ID field
run: |
NUMBER=${{ github.event.issue.number || github.event.pull_request.number }}
gh project item-edit --project-id "$PROJECT_ID" --id "$ITEM_ID" \
--field-id "$ID_FIELD" --text "DOCS-$NUMBER"
- name: Set Solution field
run: |
LABELS='${{ toJson(github.event.issue.labels.*.name) }}'
OPTION_ID=""
if echo "$LABELS" | grep -q '"solution/sofs"'; then
OPTION_ID="b2185eef"
elif echo "$LABELS" | grep -q '"solution/avd"'; then
OPTION_ID="7cf8219a"
elif echo "$LABELS" | grep -q '"solution/loadtools"'; then
OPTION_ID="64d65b5b"
elif echo "$LABELS" | grep -q '"solution/vmconvert"'; then
OPTION_ID="f71796d1"
elif echo "$LABELS" | grep -q '"solution/docs-site"'; then
OPTION_ID="7bbdc789"
elif echo "$LABELS" | grep -q '"solution/workspace"'; then
OPTION_ID="650f0277"
elif echo "$LABELS" | grep -q '"solution/toolkit"'; then
OPTION_ID="f3fc2eb6"
elif echo "$LABELS" | grep -q '"solution/aks"'; then
OPTION_ID="e4b9726f"
elif echo "$LABELS" | grep -q '"solution/sql-ha"'; then
OPTION_ID="d7d292f1"
elif echo "$LABELS" | grep -q '"solution/iot"'; then
OPTION_ID="2c047026"
elif echo "$LABELS" | grep -q '"solution/vmware-migration"'; then
OPTION_ID="23dd2e36"
elif echo "$LABELS" | grep -q '"solution/monitoring"'; then
OPTION_ID="1fc16dcb"
elif echo "$LABELS" | grep -q '"solution/bcdr"'; then
OPTION_ID="dd141ea7"
elif echo "$LABELS" | grep -q '"solution/cost"'; then
OPTION_ID="6f81bd4e"
elif echo "$LABELS" | grep -q '"solution/governance"'; then
OPTION_ID="1fd11609"
elif echo "$LABELS" | grep -q '"solution/hydration"'; then
OPTION_ID="30a52397"
elif echo "$LABELS" | grep -q '"solution/custom-images"'; then
OPTION_ID="0cde334b"
elif echo "$LABELS" | grep -q '"solution/app-services"'; then
OPTION_ID="436901f3"
elif echo "$LABELS" | grep -q '"solution/sql-mi"'; then
OPTION_ID="c8760fe8"
elif echo "$LABELS" | grep -q '"solution/ml-ai"'; then
OPTION_ID="e3576d22"
elif echo "$LABELS" | grep -q '"solution/vms"'; then
OPTION_ID="8addd3d6"
elif echo "$LABELS" | grep -q '"solution/disconnected"'; then
OPTION_ID="13d87860"
elif echo "$LABELS" | grep -q '"solution/training"'; then
OPTION_ID="9c6e8126"
elif echo "$LABELS" | grep -q '"solution/copilot"'; then
OPTION_ID="7a6a8a62"
elif echo "$LABELS" | grep -q '"solution/nutanix-migration"'; then
OPTION_ID="9f4b57e8"
elif echo "$LABELS" | grep -q '"solution/ranger"'; then
OPTION_ID="199aba19"
fi
if [ -n "$OPTION_ID" ]; then
gh project item-edit --project-id "$PROJECT_ID" --id "$ITEM_ID" \
--field-id "$SOLUTION_FIELD" --single-select-option-id "$OPTION_ID"
fi
- name: Set Priority field
run: |
LABELS='${{ toJson(github.event.issue.labels.*.name) }}'
OPTION_ID=""
if echo "$LABELS" | grep -q '"priority/critical"'; then
OPTION_ID="74334e8d"
elif echo "$LABELS" | grep -q '"priority/high"'; then
OPTION_ID="2e3ede9d"
elif echo "$LABELS" | grep -q '"priority/medium"'; then
OPTION_ID="7709e85d"
elif echo "$LABELS" | grep -q '"priority/low"'; then
OPTION_ID="2182b5f9"
fi
if [ -n "$OPTION_ID" ]; then
gh project item-edit --project-id "$PROJECT_ID" --id "$ITEM_ID" \
--field-id "$PRIORITY_FIELD" --single-select-option-id "$OPTION_ID"
fi
- name: Set Category field
run: |
LABELS='${{ toJson(github.event.issue.labels.*.name) }}'
OPTION_ID=""
if echo "$LABELS" | grep -q '"type/feature"'; then
OPTION_ID="7a4fa8ea"
elif echo "$LABELS" | grep -q '"type/bug"'; then
OPTION_ID="206e624a"
elif echo "$LABELS" | grep -q '"type/docs"'; then
OPTION_ID="355ce6c1"
elif echo "$LABELS" | grep -q '"type/infra"'; then
OPTION_ID="05996f93"
elif echo "$LABELS" | grep -q '"type/refactor"'; then
OPTION_ID="7f5509ab"
elif echo "$LABELS" | grep -q '"type/security"'; then
OPTION_ID="d2af4749"
fi
if [ -n "$OPTION_ID" ]; then
gh project item-edit --project-id "$PROJECT_ID" --id "$ITEM_ID" \
--field-id "$CATEGORY_FIELD" --single-select-option-id "$OPTION_ID"
fi