-
Notifications
You must be signed in to change notification settings - Fork 8
139 lines (121 loc) · 4.06 KB
/
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: PR
run-name: "PR - (#${{ github.event.number }}) ${{ github.event.pull_request.title }}"
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
- ready_for_review
branches: main
permissions:
contents: read
jobs:
pyversion:
name: Discover minimum Python version
uses: ./.github/workflows/_discover_python_ver.yml
code_format:
name: Formatting and security
needs: pyversion
uses: ./.github/workflows/sub_format.yml
with:
python_version: ${{ needs.pyversion.outputs.pyversion }}
unit_tests:
name: Unit Tests
needs: pyversion
permissions:
contents: read
pull-requests: write
uses: ./.github/workflows/sub_unittest.yml
with:
python_version: ${{ needs.pyversion.outputs.pyversion }}
documentation_check:
name: API documentation
needs: pyversion
uses: ./.github/workflows/sub_docs.yml
with:
python_version: ${{ needs.pyversion.outputs.pyversion }}
docker_image_test_build:
name: Build Docker image
needs: pyversion
permissions:
contents: read
packages: write
uses: ./.github/workflows/_docker.yml
with:
publish: false
python_version: ${{ needs.pyversion.outputs.pyversion }}
store_documentation:
name: Fetch the updated documentation
needs:
- code_format
- unit_tests
- documentation_check
- docker_image_test_build
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
- name: pack the documentation
working-directory: docs
run: tar --exclude .DS_Store --exclude sidebars.js -cvf documentation.tar *
- name: upload the documentation artifact
uses: actions/upload-artifact@v4
with:
name: documentation
path: docs/documentation.tar
pandev_pr:
name: Create a preview PR for pan.dev
needs: store_documentation
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: checkout pan.dev
uses: actions/checkout@v4
with:
repository: PaloAltoNetworks/pan.dev
token: ${{ secrets.CLSC_PAT }}
- name: download documentation artifact
uses: actions/download-artifact@v3
with:
name: documentation
path: products/panos/docs
- name: unpack the documentation
working-directory: products/panos/docs
run: |
rm -rf 'panos-upgrade-assurance'
tar xvf documentation.tar
rm -f documentation.tar
- name: create a PR to upstream pan.dev
id: pr
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.CLSC_PAT }}
delete-branch: true
branch: "pua_prev_${{ github.event.pull_request.head.ref }}"
title: "[PAN-OS Upgrade Assurance][${{ github.event.pull_request.head.ref }}] documentation PREVIEW - do NOT MERGE"
commit-message: "docs: PanOS Upgrade Assurance documentation update"
labels: netsec, DO NOT MERGE
body: |
# Description
DO NOT MERGE - preview PR made for changes on branch: ${{ github.event.pull_request.head.ref }}.
# Types of changes
New feature (non-breaking change which adds functionality)
- name: find if we have a comment
uses: peter-evans/find-comment@v2
id: find
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: A Preview PR in PanDev repo has been created
repository: ${{ github.repository }}
- name: comment back on the original PR
if: steps.find.outputs.comment-id == '' && steps.pr.outputs.pull-request-url != ''
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
repository: ${{ github.repository }}
body: |
A Preview PR in PanDev repo has been created. You can view it [here](${{ steps.pr.outputs.pull-request-url }}).