Skip to content

Commit 7294f1f

Browse files
committed
Add GitHub Actions script to notify on workflow failure
1 parent ab1b16e commit 7294f1f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.github/workflows/dotnet-deployment.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ jobs:
3535
run: dotnet build --no-restore src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
3636
- name: Test
3737
run: dotnet test --no-build --verbosity normal src/Application/tests/RazorPagesTestSample.Tests/RazorPagesTestSample.Tests.csproj
38+
- uses: actions/github-script@v6
39+
if: failure()
40+
with:
41+
github-token: ${{secrets.GITHUB_TOKEN}}
42+
script: |
43+
let body = "${{ env.build_name }} Workflow Failure \n Build Number: ${{ github.run_number }} \n Build Log: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} \n SHA: [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) \n";
44+
github.issues.create({
45+
owner: context.repo.owner,
46+
repo: context.repo.repo,
47+
title: "${{ env.build_name }} Workflow ${{ github.run_number }} Failed! ",
48+
body: body
49+
});
3850
3951
dockerBuildPush:
4052
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)