-
Notifications
You must be signed in to change notification settings - Fork 2
59 lines (46 loc) · 1.64 KB
/
pull_request.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Run .NET tests and Lint Dockerfile
on:
pull_request:
types: [assigned, opened, synchronize, reopened]
jobs:
test_dot_net:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Fetch secrets from key vault
uses: azure/CLI@v2
id: fetch-secrets
with:
inlineScript: |
SECRET_VALUE=$(az keyvault secret show --name "SLACK-WEBHOOK" --vault-name "${{ secrets.INFRA_KEY_VAULT}}" --query "value" -o tsv)
echo "::add-mask::$SECRET_VALUE"
echo "SLACK-WEBHOOK=$SECRET_VALUE" >> $GITHUB_OUTPUT
- name: set-up-environment
uses: DFE-Digital/github-actions/set-up-environment@master
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.0'
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore /warnaserror
- name: Spin Up Stack
run: docker-compose up -d
- name: Test
run: dotnet test --no-restore --verbosity normal
- name: Lint Dockerfile
uses: brpaz/hadolint-action@master
with:
dockerfile: "Dockerfile"
- name: Slack Notification
if: failure() && github.ref == 'refs/heads/master'
uses: rtCamp/action-slack-notify@master
env:
SLACK_COLOR: ${{env.SLACK_FAILURE }}
SLACK_MESSAGE: Pipeline Failure carrying out job ${{github.job}}
SLACK_TITLE: 'Failure: ${{ github.workflow }}'
SLACK_WEBHOOK: ${{ steps.fetch-secrets.outputs.SLACK-WEBHOOK }}