-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding workflow that triggers the azdo pipeline from a github action
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
1 parent
26cb705
commit e4afd89
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
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
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" |