Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .github/workflows/asim-pr-label-notify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: PR Label Notification

on:
pull_request:
types: [labeled, opened, reopened]

permissions:
contents: read

jobs:
# ════════════════════════════════════════════════════════════════════════
# JOB 1: Triggered when PR is labeled/opened — creates ADO work item
# ════════════════════════════════════════════════════════════════════════
notify-on-label:
name: Create ADO Work Item on Label
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'ASIM')

steps:
# ── Step 1: Collect PR metadata ──────────────────────────────────────
- name: Set PR Info
id: pr_info
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
LABEL: ${{ github.event.label.name }}
run: |
{
echo "pr_title<<EOF"
echo "$PR_TITLE"
echo "EOF"
echo "pr_url<<EOF"
echo "$PR_URL"
echo "EOF"
echo "pr_author<<EOF"
echo "$PR_AUTHOR"
echo "EOF"
echo "pr_number<<EOF"
echo "$PR_NUMBER"
echo "EOF"
echo "repo<<EOF"
echo "$REPO"
echo "EOF"
echo "label<<EOF"
echo "$LABEL"
echo "EOF"
} >> "$GITHUB_OUTPUT"

# ── Step 2: Create ADO Work Item ─────────────────────────────────────
- name: Create ADO Work Item
id: ado_task
run: |
RESPONSE=$(curl -s -X POST \
-u ":${{ secrets.ASIM_ADO_PAT }}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{
"op": "add",
"path": "/fields/System.Title",
"value": "PR #${{ steps.pr_info.outputs.pr_number }}: ${{ steps.pr_info.outputs.pr_title }}"

Check warning

Code scanning / CodeQL

Code injection Medium

Potential code injection in
${ steps.pr_info.outputs.pr_title }
, which may be controlled by an external user.
},
{
"op": "add",
"path": "/fields/System.Description",
"value": "<b>GitHub PR:</b> \"${{<br/><b>Author:</b> ${{ steps.pr_info.outputs.pr_author }}<br/><b>Label:</b> ${{ steps.pr_info.outputs.label }}<br/><b>Repo:</b> ${{ steps.pr_info.outputs.repo }}"
},
{
"op": "add",
"path": "/fields/System.AreaPath",
"value": "${{ secrets.ASIM_ADO_AREA_PATH }}"
},
{
"op": "add",
"path": "/fields/System.Tags",
"value": "github-pr; ASIM"
},
{
"op": "add",
"path": "/fields/Microsoft.VSTS.Common.Priority",
"value": 2
},
{
"op": "add",
"path": "/relations/-",
"value": {
"rel": "Hyperlink",
"url": "${{ steps.pr_info.outputs.pr_url }}",
"attributes": { "comment": "Linked GitHub PR" }
}
},
{
"op": "add",
"path": "/relations/-",
"value": {
"rel": "System.LinkTypes.Hierarchy-Reverse",
"url": "${{ secrets.ASIM_ADO_URL }}/${{ secrets.ASIM_ADO_PROJECT }}/_apis/wit/workitems/5177225",
"attributes": { "comment": "Child of PBI #5177225" }
}
}
]' \
"${{ secrets.ASIM_ADO_URL }}/${{ secrets.ASIM_ADO_PROJECT }}/_apis/wit/workitems/\$Task?api-version=7.1")

ADO_ITEM_ID=$(echo $RESPONSE | python3 -c "import sys, json; print(json.load(sys.stdin)['id'])")
Loading