Skip to content

fix: [.NET Core] Remove .UseAuthorization if unnecessary for running bots #2920 #50

fix: [.NET Core] Remove .UseAuthorization if unnecessary for running bots #2920

fix: [.NET Core] Remove .UseAuthorization if unnecessary for running bots #2920 #50

name: ci-dotnet-samples
env:
ROOT_FOLDER: BotBuilder-Samples/samples/
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- "samples/**/*.cs"
jobs:
generate:
name: detect and generate bot matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- name: git diff
uses: technote-space/get-diff-action@v4
with:
PATTERNS: samples/**/*.cs
ABSOLUTE: true
- name: generate matrix
id: set-matrix
shell: pwsh
if: env.GIT_DIFF
run: |
function UpSearchFolder {
param ([String] $path, [String] $file)
while ($path -and !(Test-Path (Join-Path $path $file))) {
$path = Split-Path $path -Parent
}
return $path
}
$paths = @("${{ env.GIT_DIFF_FILTERED }}" -replace "'", "" -split " ")
$rootFolder = "${{ env.ROOT_FOLDER }}"
$result = $paths | ForEach-Object { UpSearchFolder -path $_ -file "*.csproj" } | Get-Unique | ForEach-Object {
$folder = $_
return @{
name = $folder.Substring($folder.IndexOf($rootFolder) + $rootFolder.Length);
folder = $folder;
}
}
"Generated matrix:"
ConvertTo-Json @($result)
$matrix = ConvertTo-Json -Compress @($result)
echo "::set-output name=matrix::$($matrix)"
build:
needs: generate
runs-on: ubuntu-latest
strategy:
matrix:
include: ${{fromJSON(needs.generate.outputs.matrix)}}
fail-fast: false
name: bot - ${{ matrix.name }}
steps:
- uses: actions/checkout@v3
- name: use .net 6.0.x
uses: actions/setup-dotnet@v2
with:
dotnet-version: "6.0.x"
- name: dotnet restore
run: dotnet restore
working-directory: ${{ matrix.folder }}
- name: dotnet build
run: dotnet build --configuration Release --no-restore --nologo --clp:NoSummary
working-directory: ${{ matrix.folder }}