Skip to content

Adding Copilot Studio Client API and SPA Sample #113

Adding Copilot Studio Client API and SPA Sample

Adding Copilot Studio Client API and SPA Sample #113

Workflow file for this run

name: Pull Request Build and Validation
on:
pull_request:
branches:
- main
env:
AzDevOpsPipelineId: 25676
permissions:
id-token: write
contents: read
jobs:
build:
if: (github.event.pull_request.base.repo.full_name == github.event.pull_request.head.repo.full_name) && (github.event_name == 'pull_request')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Azure DevOps Access Token
id: getToken
uses: "./.github/actions/get-ado-token"
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
organization: ${{ vars.AZDEVOPS_ORGANIZATION }}
- name: Trigger Azure DevOps Pipeline
id: trigger
run: |
response=$(curl -v -X POST \
-H "Authorization: Bearer ${{ steps.getToken.outputs.token }}" \
-H "Content-Type: application/json" \
-d '{"resources": {"repositories": {"self": {"refName": "refs/heads/main"}}},"variables": {"ProjectBranch": {"value": "${{ github.head_ref || github.ref_name }}"}}}' \
${{ vars.AZDEVOPS_URL }}/_apis/pipelines/${{ env.AzDevOpsPipelineId }}/runs?api-version=7.1)
echo $BRANCH_NAME
echo $response
echo "::set-output name=run_id::$(echo $response | jq -r .id)"
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
# -d '{"resources": {"repositories": {"self": {"refName": "refs/heads/main"}}}}' \
# refs/heads/users/mbarbour/pipelineUpdate
- name: Monitor Pipeline Run
run: |
run_id=${{ steps.trigger.outputs.run_id }}
status="inProgress"
while [ "$status" == "inProgress" ] || [ "$status" == "notStarted" ] || [ "$status" == "canceling" ] ; do
response=$(curl -X GET \
-H "Authorization: Bearer ${{ steps.getToken.outputs.token }}" \
${{ vars.AZDEVOPS_URL }}/_apis/pipelines/${{ env.AzDevOpsPipelineId }}/runs/$run_id?api-version=7.1)
status=$(echo $response | jq -r .state)
r1=$(echo $response | jq -r .result)
weblink=$(echo $response | jq -r ._links.web.href)
echo "Pipeline status: $status"
echo "Result response: $r1"
echo "WebLink: $weblink"
if [ "$status" == "completed" ]; then
result=$(echo $response | jq -r .result)
if [ "$result" == "succeeded" ]; then
echo "Pipeline succeeded"
exit 0
else
echo "::error file={name},line={line},endLine={endLine},title={title}::Pipeline failed with result: $result"
echo "Pipeline failed with result: $result"
exit 1
fi
fi
sleep 10
done