Skip to content

Commit

Permalink
Adding workflow that triggers the azdo pipeline from a github action
Browse files Browse the repository at this point in the history
I made a mistake on the extension of the yml file, and renamed the previous one. it was not showing up on github actions
  • Loading branch information
svelderrainruiz committed Dec 5, 2024
1 parent 26cb705 commit e4afd89
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
File renamed without changes.
38 changes: 38 additions & 0 deletions .github/workflows/trigger-azure-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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"

0 comments on commit e4afd89

Please sign in to comment.