-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7afbc77
commit 751160e
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
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,53 @@ | ||
# This workflow will build a .NET project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | ||
|
||
name: .NET | ||
|
||
on: | ||
push: | ||
branches: [ "test" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Work out last successful commit | ||
id: setSHAs | ||
uses: nrwl/nx-set-shas@v4 | ||
|
||
- name: Determine affected projects | ||
id: dotnet_affected | ||
run: | | ||
dotnet tool install dotnet-affected && touch affected.txt | ||
if dotnet affected -f text traversal \ | ||
--from "${{ steps.setSHAs.outputs.base }}" \ | ||
--to "${{ github.sha }}"; then | ||
if [ -s affected.txt ]; then | ||
cat affected.txt | ||
echo "Number of affected projects: " $(wc -l < affected.txt) | ||
echo "has_output=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "No affected projects." | ||
echo "has_output=false" >> $GITHUB_OUTPUT | ||
fi | ||
elif [ $? -ne 166 ]; then | ||
echo "Exiting, error occurred" | ||
exit 1 | ||
else | ||
echo "No affected projects." | ||
echo "has_output=false" >> $GITHUB_OUTPUT | ||
fi | ||
|
||
- name: Test affected projects | ||
if: steps.dotnet_affected.outputs.has_output == 'true' | ||
run: dotnet test affected.proj |