-
Notifications
You must be signed in to change notification settings - Fork 11
72 lines (62 loc) · 1.97 KB
/
pr-check.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
60
61
62
63
64
65
66
67
68
69
70
71
72
---
name: pr check
permissions:
contents: read
pull-requests: write
id-token: write
on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
libschanged:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- name: Get list of changed libs
id: libs
run: |
DIFF="$(git diff --name-only origin/${{ github.base_ref }} | xargs dirname | sort | uniq)"
LIBDIFF="$(echo "${DIFF}" | grep '^platform/' || true)"
if [ -z "${LIBDIFF}" ]; then
echo "No libraries changed"
echo "list=[]" >> "$GITHUB_OUTPUT"
exit 0
fi
LIBS=$(echo "${LIBDIFF}" | cut -d'/' -f2 | sort | uniq)
JSONARRAY=$(echo "${LIBS}" | jq -R -s -c 'split("\n")'[:-1])
echo "list=${JSONARRAY}" >> "$GITHUB_OUTPUT"
shell: bash
outputs:
list: ${{ steps.libs.outputs.list }}
checklib:
needs: libschanged
if: ${{ needs.libschanged.outputs.list != '[]' }}
runs-on: ubuntu-latest
environment: test
strategy:
matrix:
lib: ${{ fromJson(needs.libschanged.outputs.list) }}
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
check-latest: true
- name: Install alzlibtool
run: go install github.com/Azure/alzlib/cmd/[email protected]
- name: Azure login
uses: azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2.1.1
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
allow-no-subscriptions: true
- name: Check lib
run: |
alzlibtool check library "platform/${{ matrix.lib }}"
shell: bash