From c04f35df4ed78b6ce29e308dbf74b914dcbc8aed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jordi=20Su=C3=B1=C3=A9?= <39730064+josunefon@users.noreply.github.com> Date: Wed, 19 Oct 2022 17:56:03 +0200 Subject: [PATCH] Create issues from GH to ADO (#274) --- .github/workflows/issues.yaml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/issues.yaml diff --git a/.github/workflows/issues.yaml b/.github/workflows/issues.yaml new file mode 100644 index 0000000..1a265b4 --- /dev/null +++ b/.github/workflows/issues.yaml @@ -0,0 +1,32 @@ +on: + issues: + types: + - opened +jobs: + create_ado_pbi: + runs-on: ubuntu-latest + steps: + - env: + GITHUB_TOKEN: ${{ secrets.PAT }} + name: 'Get GH issue' + id: gh + shell: pwsh + run: | + $gh_issue_json = gh issue view ${{ github.event.issue.html_url }} --json assignees,author,body,closed,closedAt,comments,createdAt,id,labels,milestone,number,projectCards,reactionGroups,state,title,updatedAt,url + $gh_issue = ConvertFrom-Json $gh_issue_json + #$gh_issue.title + echo "::set-output name=title::$($gh_issue.title)" + echo "::set-output name=url::$($gh_issue.url)" + + - name: 'Create PBI in ADO' + id: ado + uses: azure/CLI@v1 + with: + azcliversion: 2.30.0 + inlineScript: | + ado_title=$(echo ${{steps.gh.outputs.title}}) + ado_url=$(echo ${{steps.gh.outputs.url}}) + export AZURE_DEVOPS_EXT_PAT=${{ secrets.ADO_PAT }} + az extension add --name azure-devops + ado_issue=$(az boards work-item create --title $ado_title --type 'Bug' -d $ado_url --org 'https://dev.azure.com/strategy-and-solutions/' -p 'product-portfolio' -o json --query "id") + az boards work-item relation add --id '104' --relation-type 'child' --target-id $ado_issue --org 'https://dev.azure.com/strategy-and-solutions/'