Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test pull request #107

Merged
merged 5 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/Run unit tests and build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
build_id: ${{ github.run_number }}
build_revision: ${{ steps.get_revision.outputs.build_revision }}
build_version: 1.0.${{ env.build_id }}.${{ env.build_revision }}
RelativePath: ${{ github.workspace }}
RelativePathScripts: ${{ github.workspace }}/pipeline/scripts
RelativePath: ${{ vars.AgentWorkingFolder }}
RelativePathScripts: ${{ vars.AgentWorkingFolder }}/pipeline/scripts

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v1

- name: Get Build Revision
id: get_revision
Expand Down
29 changes: 15 additions & 14 deletions .github/workflows/trigger-azure-pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
name: PR Triggered Tests

on:
# Using pull_request_target so we can access secrets
pull_request_target:
types: [opened, synchronize, reopened]

jobs:
trigger-azure-pipeline:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.base.ref, 'develop') # optional: trigger only if PR is into main
if: contains(github.event.pull_request.base.ref, 'develop')
steps:
- name: Check if authorized to run tests
id: check
run: |
# Implement your logic here. For example, check PR labels using GitHub CLI:
# gh pr view ${{ github.event.pull_request.number }} --json labels
# if no label or unauthorized contributor, exit
# For simplicity, we just say we always trigger. In reality, add conditions.
# Add any conditions if necessary. For now, always allow.
echo "ok=true" >> $GITHUB_OUTPUT

- name: Trigger Azure DevOps Pipeline
Expand All @@ -28,16 +24,17 @@ jobs:
PIPELINE_ID="1"
API_VERSION="6.0-preview.1"

# Ensure PAT is not empty
if [ -z "$PAT" ]; then
echo "AZURE_DEVOPS_PAT is not set or empty!"
exit 1
fi

# Base64 encode credentials
AUTH=$(echo -n ":$PAT" | base64)

# We can specify a branch or a commit ref from the PR. Usually you'd run tests against the PR's branch.
# Since we're using pull_request_target, be careful with checking out code from PR.
# It's safer to just run pipeline against the PR's head commit reference retrieved from the event payload.
# Use the PR's head ref for the pipeline branch
PR_HEAD_REF="${{ github.event.pull_request.head.ref }}"
REPO_NAME="${{ github.event.pull_request.head.repo.name }}"
# If your Azure DevOps pipeline is configured to use the same repo, specify it here:
# Ensure that your pipeline definition knows how to handle arbitrary refs.

JSON_BODY='{
"resources": {
"repositories": {
Expand All @@ -48,7 +45,11 @@ jobs:
}
}'

curl -s -X POST \
echo "Triggering Azure DevOps pipeline with the following JSON:"
echo "$JSON_BODY"

# Use --http1.1 to avoid HTTP/2 related issues, remove -s for verbosity
curl --http1.1 -v -X POST \
-H "Authorization: Basic $AUTH" \
-H "Content-Type: application/json" \
-d "$JSON_BODY" \
Expand Down
Binary file removed Tooling/support/Add dev dist if present.vi
Binary file not shown.