Revert "GIthub action now triggers and monitors azure devops pipeline" #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |