Skip to content

Commit

Permalink
Update trigger-azure-pipeline.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
svelderrainruiz committed Dec 12, 2024
1 parent 4a52ee4 commit 21be74a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/trigger-azure-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ name: PR Triggered Tests
on:
pull_request_target:
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
trigger-azure-pipeline:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.base.ref, 'main')
if: contains(github.event.pull_request.base.ref, 'main') || github.event_name == 'workflow_dispatch'
steps:
- name: Check if authorized to run tests
id: check
Expand All @@ -34,8 +35,14 @@ jobs:
# Base64 encode credentials and remove newline
AUTH=$(echo -n ":$PAT" | base64 | tr -d '\n')
# Use the PR's head ref for the pipeline branch
PR_HEAD_REF="${{ github.event.pull_request.head.ref }}"
# Use the PR's head ref for the pipeline branch if it's a PR event
# If manually triggered (workflow_dispatch), default to a known branch like 'develop'
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
PR_HEAD_REF="develop"
else
PR_HEAD_REF="${{ github.event.pull_request.head.ref }}"
fi
JSON_BODY='{
"resources": {
"repositories": {
Expand Down

0 comments on commit 21be74a

Please sign in to comment.