Repository navigation
79 lines (67 loc) · 2.83 KB
/
Copy pathpull-request.yml
File metadata and controls
79 lines (67 loc) · 2.83 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: PR build and merge
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: "Checkout"
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: "Build test containers"
run: make build
- name: "Create environment file"
run: env | grep -E '^MPT_' > .env
env:
RP_ENDPOINT: ${{ secrets.RP_ENDPOINT }}
RP_API_KEY: ${{ secrets.RP_API_KEY }}
MPT_API_BASE_URL: ${{ secrets.MPT_API_BASE_URL }}
MPT_API_TOKEN: ${{ secrets.MPT_API_TOKEN }}
MPT_API_TOKEN_CLIENT: ${{ secrets.MPT_API_TOKEN_CLIENT }}
MPT_API_TOKEN_OPERATIONS: ${{ secrets.MPT_API_TOKEN_OPERATIONS }}
MPT_API_TOKEN_VENDOR: ${{ secrets.MPT_API_TOKEN_VENDOR }}
- name: "Run validation & test"
run: make check-all
- name: "Compute added/removed lines for notification"
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
id: diff
run: |
PR_DATA=$(gh pr view "${{ github.event.pull_request.number }}" --json additions,deletions -q '.')
ADDITIONS=$(echo "$PR_DATA" | jq '.additions')
DELETIONS=$(echo "$PR_DATA" | jq '.deletions')
echo "additions=$ADDITIONS" >> $GITHUB_OUTPUT
echo "deletions=$DELETIONS" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Notify Microsoft Teams"
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
uses: softwareone-platform/notify-pr-teams-action@v5
with:
webhook_url: ${{ secrets.TEAMS_WEBHOOK_URL }}
bot_image_url: https://raw.githubusercontent.com/softwareone-platform/mpt-api-python-client/main/.github/workflows/assets/turing_team_pr_bot.png
repo: ${{ github.repository }}
pr_url: ${{ github.event.pull_request.html_url }}
pr_title: ${{ github.event.pull_request.title }}
pr_author: ${{ github.event.pull_request.user.login }}
head_ref: ${{ github.event.pull_request.head.ref }}
base_ref: ${{ github.event.pull_request.base.ref }}
commits: ${{ github.event.pull_request.commits }}
changed_files: ${{ github.event.pull_request.changed_files }}
additions: ${{ steps.diff.outputs.additions }}
deletions: ${{ steps.diff.outputs.deletions }}
pr_number: ${{ github.event.pull_request.number }}
pr_status: ${{ github.event.pull_request.state }}
is_merged: ${{ github.event.pull_request.merged }}
- name: "Run SonarCloud Scan"
uses: SonarSource/sonarqube-scan-action@v8.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: "Stop containers"
if: always()
run: make down