Skip to content

Revert "GIthub action now triggers and monitors azure devops pipeline" #8

Revert "GIthub action now triggers and monitors azure devops pipeline"

Revert "GIthub action now triggers and monitors azure devops pipeline" #8

name: Trigger Azure DevOps Pipeline
on:
push:
branches: [ main, develop ]
jobs:
trigger-azure-pipeline:
runs-on: ubuntu-latest
steps:
- name: Trigger Azure DevOps Pipeline
run: |
PAT="${{ secrets.AZURE_DEVOPS_PAT }}" # Azure DevOps Personal Access Token
ORG="sergiovelderrain" # Replace with your Azure DevOps org name
PROJECT="sergiovelderrain" # Replace with your project name
PIPELINE_ID="1" # Replace with your pipeline ID
API_VERSION="6.0-preview.1"
# Create base64 encoded auth header value
AUTH=$(echo -n ":$PAT" | base64)
# JSON body to specify branch or other resources (adjust as needed)
JSON_BODY='{
"resources": {
"repositories": {
"self": {
"refName": "refs/heads/'"${GITHUB_REF##*/}"'"
}
}
}
}'
# Trigger Azure DevOps pipeline run
curl -X POST \
-H "Authorization: Basic $AUTH" \
-H "Content-Type: application/json" \
-d "$JSON_BODY" \
"https://dev.azure.com/$ORG/$PROJECT/_apis/pipelines/$PIPELINE_ID/runs?api-version=$API_VERSION"