-
Notifications
You must be signed in to change notification settings - Fork 26
56 lines (50 loc) · 1.67 KB
/
on-pr_nrf_manifest_update_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
name: handle manifest PR
on:
pull_request_target:
types: [opened, synchronize, closed]
branches:
- main
jobs:
read_pr_configuration:
runs-on: ubuntu-latest
outputs:
Create_NRF_PR: ${{ steps.config.outputs.Create_NRF_PR }}
steps:
- name: Print Github context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- 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
create_pr=$(yq '.Github_actions.Create_NRF_PR' configuration.yaml)
if [ $? != 0 ]; then
echo "Did not found Create_NRF_PR in configuration, default to false."
echo "Create_NRF_PR=false" >> $GITHUB_OUTPUT;
else
echo "Create_NRF_PR=$create_pr" >> $GITHUB_OUTPUT;
fi;
create-manifest-pr:
runs-on: ubuntu-latest
needs: read_pr_configuration
if: ${{ fromJson(needs.read_pr_configuration.outputs.Create_NRF_PR)}}
steps:
- name: Create manifest PR
uses: nrfconnect/action-manifest-pr@main
with:
token: ${{ secrets.NCS_GITHUB_TOKEN }}