Skip to content

Commit 10c2eba

Browse files
Merge pull request #9562 from MicrosoftDocs/kaushika-msft-patch-3
Create create-ado-workitem.yml
2 parents c24471a + 03bf245 commit 10c2eba

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Create Azure DevOps CI on PR
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
7+
jobs:
8+
create-work-item:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Create Azure DevOps Task
12+
env:
13+
ADO_ORG_URL: https://dev.azure.com/KMOps
14+
ADO_PROJECT: ContentExperience
15+
ADO_PAT: ${{ secrets.ADO_PAT }}
16+
run: |
17+
PR_TITLE="${{ github.event.pull_request.title }}"
18+
PR_BODY="${{ github.event.pull_request.body }}"
19+
PR_URL="${{ github.event.pull_request.html_url }}"
20+
21+
curl -X POST \
22+
-H "Content-Type: application/json-patch+json" \
23+
-H "Authorization: Basic $(echo -n ":$ADO_PAT" | base64)" \
24+
$ADO_ORG_URL/$ADO_PROJECT/_apis/wit/workitems/$ExternalCI?api-version=6.0 \
25+
-d '[
26+
{
27+
"op": "add",
28+
"path": "/fields/System.Title",
29+
"value": "PR Opened: '"$PR_TITLE"'"
30+
},
31+
{
32+
"op": "add",
33+
"path": "/fields/System.Description",
34+
"value": "Pull Request URL: '"$PR_URL"'\n\n'"$PR_BODY"'"
35+
}
36+
]'

0 commit comments

Comments
 (0)