-
Notifications
You must be signed in to change notification settings - Fork 26
73 lines (63 loc) · 2.04 KB
/
on-pr.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
73
name: On PR action
on:
pull_request:
jobs:
Run_Configuration:
runs-on: ubuntu-latest
outputs:
NRF_revision: ${{ steps.config.outputs.NRF_revision }}
steps:
- name: Read body of PR
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/${{github.repository}}/pulls/${{github.event.number}} --jq '.body' > pr_body.md
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: install yq
run: pip install yq
- name: Get configuration
id: config
shell: bash {0}
run: |
csplit pr_body.md /\`\`\`yaml/1
csplit xx01 /\`\`\`/
mv xx00 configuration.yaml
cat configuration.yaml
revision=$(yq '.Github_actions.NRF_revision' configuration.yaml)
if [ $? != 0 ]; then
echo "Failed to read configuration use default main for NRF_revision"
echo "NRF_revision=main" >> $GITHUB_OUTPUT;
else
echo "NRF_revision=$revision" >> $GITHUB_OUTPUT;
fi;
- name: print nrf revision
run: |
echo ${{ steps.config.outputs.NRF_revision }}
verify_PR:
uses: ./.github/workflows/validate_code_style.yml
with:
reference_commit: ${{ github.event.pull_request.base.sha }}
save_pr_number:
runs-on: ubuntu-latest
steps:
- name: Save PR number to file
run: |
echo "${{ github.event.number }}" > PR_number
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: PR_number
path: |
PR_number
build_samples:
needs: Run_Configuration
uses: ./.github/workflows/samples_build.yml
with:
nrf_revision: ${{needs.Run_Configuration.outputs.NRF_revision}}
build_and_run_tests:
needs: Run_Configuration
uses: ./.github/workflows/run_tests.yml
with:
nrf_revision: ${{needs.Run_Configuration.outputs.NRF_revision}}