diff --git a/.github/ISSUE_TEMPLATE/01-kiota-bug.yml b/.github/ISSUE_TEMPLATE/01-kiota-bug.yml index d0407046c2..c57677cabc 100644 --- a/.github/ISSUE_TEMPLATE/01-kiota-bug.yml +++ b/.github/ISSUE_TEMPLATE/01-kiota-bug.yml @@ -32,11 +32,11 @@ body: - type: dropdown id: language attributes: - label: Client Library/SDK Language + label: Client library/SDK language description: If Client SDK, what's the language in use? multiple: false options: - - C# + - Csharp - CLI - Go - Java @@ -45,6 +45,7 @@ body: - Python - Ruby - TypeScript + - Swift validations: required: false - type: textarea diff --git a/.github/ISSUE_TEMPLATE/02-kiota-feature-request.yml b/.github/ISSUE_TEMPLATE/02-kiota-feature-request.yml index 6bc778d746..4962149da7 100644 --- a/.github/ISSUE_TEMPLATE/02-kiota-feature-request.yml +++ b/.github/ISSUE_TEMPLATE/02-kiota-feature-request.yml @@ -21,7 +21,7 @@ body: description: Is feature request related to any client library/SDK language? multiple: false options: - - C# + - Csharp - CLI - Go - Java @@ -30,6 +30,7 @@ body: - Python - Ruby - TypeScript + - Swift validations: required: false - type: textarea diff --git a/.github/workflows/graphprojects.yml b/.github/workflows/project-auto-add.yml similarity index 52% rename from .github/workflows/graphprojects.yml rename to .github/workflows/project-auto-add.yml index f697bf9b89..af0fb3a2c9 100644 --- a/.github/workflows/graphprojects.yml +++ b/.github/workflows/project-auto-add.yml @@ -1,12 +1,19 @@ -# This workflow is used to add new issues to GitHub Projects (Beta) +# This workflow is used to add new issues to GitHub Kiota Project -name: Add PR to project +name: Add Issue or PR to project on: issues: types: - opened + pull_request: + types: + - opened + branches: + - 'main' + jobs: track_issue: + if: github.actor != 'dependabot[bot]' runs-on: ubuntu-latest steps: - name: Generate token @@ -16,11 +23,26 @@ jobs: app_id: ${{ secrets.GRAPHBOT_APP_ID }} private_key: ${{ secrets.GRAPHBOT_APP_PEM }} + - name: Check if issue has language specified + env: + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} + run: | + language=$(awk '/SDK language/{flag=1;next} /Describe/{flag=0} flag' <<< "${{github.event.issue.body}}" | tr -d '[:space:]') + allowedList="PHP Python Go TypeScript Csharp Java PowerShell CLI Ruby Swift" + if [[ $allowedList =~ (^|[[:space:]])$language($|[[:space:]]) ]]; then + echo "$language is in allowed list"; + echo 'LANGUAGE='$language >> $GITHUB_ENV; + echo 'SELECTED_LANGUAGE='$language >> $GITHUB_ENV; + else + echo "$language is not allowed"; + echo 'SELECTED_LANGUAGE=Multiple Languages' >> $GITHUB_ENV; + fi + - name: Get project data env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} - ORGANIZATION: microsoftgraph - PROJECT_NUMBER: 28 + ORGANIZATION: microsoft + PROJECT_NUMBER: 220 run: | gh api graphql -f query=' query($org: String!, $number: Int!) { @@ -44,13 +66,14 @@ jobs: }' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json echo 'PROJECT_ID='$(jq '.data.organization.projectV2.id' project_data.json) >> $GITHUB_ENV - echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV - echo 'TRIAGE_OPTION_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") | .options[] | select(.name=="Needs Triage 🔍") |.id' project_data.json) >> $GITHUB_ENV + echo 'LANGUAGE_FIELD_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Language") | .id' project_data.json) >> $GITHUB_ENV + LANGUAGE_OPTION_ID=$(jq --arg lang "$SELECTED_LANGUAGE" '.data.organization.projectV2.fields.nodes[] | select(.name== "Language") | .options[] | select(.name==$lang) | .id' project_data.json) + echo "LANGUAGE_OPTION_ID=$LANGUAGE_OPTION_ID" >> $GITHUB_ENV - - name: Add Issue to project + - name: Add Issue or PR to project env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} - ISSUE_ID: ${{ github.event.issue.node_id }} + ISSUE_ID: ${{ github.event_name == 'issues' && github.event.issue.node_id || github.event.pull_request.node_id }} run: | item_id="$( gh api graphql -f query=' mutation($project:ID!, $issue:ID!) { @@ -60,10 +83,10 @@ jobs: } } }' -f project=$PROJECT_ID -f issue=$ISSUE_ID --jq '.data.addProjectV2ItemById.item.id')" - + echo 'ITEM_ID='$item_id >> $GITHUB_ENV - - name: Set Triage + - name: Set Language env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} run: | @@ -71,17 +94,17 @@ jobs: mutation ( $project: ID! $item: ID! - $status_field: ID! - $status_value: String! + $language_field: ID! + $language_value: String! ) { set_status: updateProjectV2ItemFieldValue(input: { projectId: $project itemId: $item - fieldId: $status_field - value: {singleSelectOptionId: $status_value} + fieldId: $language_field + value: {singleSelectOptionId: $language_value} }) { projectV2Item { id } } - }' -f project=$PROJECT_ID -f item=$ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=${{ env.TRIAGE_OPTION_ID }} --silent + }' -f project=$PROJECT_ID -f item=$ITEM_ID -f language_field=$LANGUAGE_FIELD_ID -f language_value=${{ env.LANGUAGE_OPTION_ID }} --silent