-
Notifications
You must be signed in to change notification settings - Fork 0
239 lines (216 loc) · 7.74 KB
/
Copy pathpull_request_updated.yml
File metadata and controls
239 lines (216 loc) · 7.74 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
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: Pull Request Opened/Updated
on:
pull_request:
#types: [ opened, synchronize, reopened ]
jobs:
add_checklist:
name: Add Checklist
runs-on: ubuntu-latest
if: github.event.action == 'opened'
steps:
- name: checklist
env:
COMMENT: |
# All of the following MUST be verified by AUTHORS before merging to `main`:
- [ ] Updated "IANA Considerations" section, or N/A?
- [ ] Updated "Security Considerations" section, or N/A?
- [ ] Updated "Normative/Informational References" sections, or N/A?
- [ ] Updated "Acknowledgements" section, or N/A? (Not GitHub users)
# The following MUST be verified by the EDITOR before merging to `main`:
- [ ] The XML artifact uploads to Datatracker?
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr comment https://github.com/netmod-wg/yang-xml/pull/${{github.event.number}} --body "$COMMENT"
xml2rfc:
name: Run xml2rfc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
fetch-tags: true
- name: generate authors.txt
run: |
chmod +x .github/workflows/gen_author_list.sh
.github/workflows/gen_author_list.sh
- name: Install xml2rfc
run: |
pip install xml2rfc
wget https://raw.githubusercontent.com/ietf-tools/rfcfold/master/rfcfold
chmod +x rfcfold
- name: Run "make"
run: |
make
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: all-artifacts
path: draft-yn-netmod-*-[0-9][0-9].*
# DISABLED because unable to get it to work (rfclint maintained?)
# rfclint:
# name: RFC Lint
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v4
# with:
# ref: ${{ github.event.pull_request.head.ref }}
# - name: Install xmllint
# run: |
# git clone https://github.com/moonshiner/rfclint.git
# cd rfclint
# git checkout tjw-fix-setup
idnits_v2:
name: Test with Idnits v2
runs-on: ubuntu-latest
needs: xml2rfc
steps:
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: all-artifacts
- name: Install idnits
run: |
git clone https://github.com/ietf-tools/idnits.git
cd idnits
git checkout v2
- name: Run idnits
run: |
./idnits/idnits --verbose draft-yn-netmod-yang-xml-[0-9][0-9].txt | tee idnits.out
- name: Extract summary line
run: echo "SUMMARY_LINE=$(cat idnits.out | tail -n 2 | head -n 1)" >> $GITHUB_ENV
- name: Test summary line for errors
run: |
echo "${{env.SUMMARY_LINE}}" | grep -q "0 errors" || {
echo "::error::Idnits returned errors."
exit 1
}
- name: Test summary line for changes
run: |
echo "${{env.SUMMARY_LINE}}" | grep -qF "0 flaws (~~), 3 warnings (==), 3 comments (--)" || {
echo "::error::Idnits summary line different - examine why (fix workflow if needed)"
exit 1
}
# DISABLED because idnits-v3 flags non-issues
# idnits_v3:
# name: Test with Idnits v3
# runs-on: macos-latest
# needs: xml2rfc
# steps:
# - name: Download a single artifact
# uses: actions/download-artifact@v4
# with:
# name: draft-yn-netmod-yang-xml-[0-9][0-9].txt
# - name: Install node
# run: |
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# export NVM_DIR="$HOME/.nvm"
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# nvm install 20
# #https://nodejs.org/dist/v20.12.2/node-v20.12.2-darwin-x64.tar.gz
# - name: Install idnits
# run: |
# npm install -g @ietf-tools/idnits
# - name: Run idnits
# run: |
# idnits draft-yn-netmod-yang-xml-[0-9][0-9].txt | tee idnits.out
# - name: Test idnits Output
# run: |
# grep -q "Summary: 1 error" idnits.out
# if [[ $? -ne 0 ]]; then
# echo "Idnits returned errors."
# exit 1
# fi
#
ensure_checklist_complete:
name: Ensure Checklist Complete
runs-on: ubuntu-latest
if: github.event.action != 'opened'
steps:
- name: Ensure Checklist Complete
uses: peter-evans/find-comment@v4
id: fc
with:
issue-number: ${{github.event.number}}
comment-author: 'github-actions[bot]'
body-includes: 'All of the following MUST be verified by AUTHORS before merging to `main`:'
- run: |
if ${{ contains(steps.fc.outputs.comment-body, '[ ] Updated') }} ; then
echo "All checklist items must be selected."
exit 1
fi
update_github_pages:
name: Update the GitHub Page
runs-on: ubuntu-latest
needs: xml2rfc
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
# checkout repo so can access the bash script
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
# create the "mysite/" directory
- name: Create the mysite/ directory
run: mkdir mysite
# download and extract drafts.tgz
- name: Download and extract drafts
run: |
cd mysite
curl -O https://netmod-wg.github.io/yang-xml/drafts.tgz
file drafts.tgz
file drafts.tgz | grep "gzip compressed data" && {
tar -xzvf drafts.tgz
}
rm drafts.tgz
# create the "mysite/<branch>/" directory (delete old if present)
- name: Create the mysite/<branch>/ directory
run: |
rm -rf mysite/${{github.head_ref}}
mkdir mysite/${{github.head_ref}}
# download the just-built artifacts
- name: Download built artifacts
uses: actions/download-artifact@v4
with:
name: all-artifacts
# mv all artifacts into the mysite/<branch>/ directory
- name: Move drafts into branch dir
run: |
mv draft-yn-netmod-*-[0-9][0-9].* mysite/${{github.head_ref}}/
# stash some metadata
- name: Stash some metadata (for gen_index_html.sh)
run: |
echo "NUMBER: ${{github.event.pull_request.number}}" > mysite/${{github.head_ref}}/metadata.txt
echo "TITLE: ${{github.event.pull_request.title}}" >> mysite/${{github.head_ref}}/metadata.txt
echo "DATE: $(date +%Y-%m-%dT%H:%M:%SZ)" >> mysite/${{github.head_ref}}/metadata.txt
echo "BASE: ${{github.base_ref}}" >> mysite/${{github.head_ref}}/metadata.txt
# delete the artifacts
- uses: geekyeggo/delete-artifact@v5
with:
name: all-artifacts
# create index.html
- name: Create mysite/index.html
run: |
chmod +x .github/workflows/gen_index_html.sh
.github/workflows/gen_index_html.sh
# recreate the drafts.tgz
- name: Recreate drafts.tgz
run: |
cd mysite
tar -czvf drafts.tgz */
mkdir _test_
cd _test_
tar -xzvf ../drafts.tgz
# upload site to github.io
- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
with:
path: "./mysite"
# deploy site to github.io
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4