File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- # This script keeps the list of extensions up to date
3
+ # This script keeps the list of extensions up to date
4
4
# in the docs/sources/next/extensions/explore.md file.
5
5
#
6
6
# The script is run by the extension-registry.changed.yml
7
7
# workflow when the extension registry changes.
8
- #
8
+ #
9
9
# The list of extensions is generated based on https://registry.k6.io/registry.json.
10
10
#
11
- # In the docs/sources/next/extensions/explore.md file
11
+ # In the docs/sources/next/extensions/explore.md file
12
12
# the content of the <div class="nav-cards"> HTML element
13
13
# is replaced with the generated extension list.
14
14
15
+ set -euf -o pipefail
16
+
15
17
generate_extension_list_partial () {
16
- curl -sL https://registry.k6.io/registry.json |
17
- jq -r '
18
+ curl -sL https://registry.k6.io/registry.json |
19
+ jq -r '
18
20
map(select(.module != "go.k6.io/k6") | { name:.repo.name, url: .repo.url, description: .description } ) |
19
21
sort_by(.name) | map(
20
22
" <a href=\"\(.url)\" target=\"_blank\" class=\"nav-cards__item nav-cards__item--guide\">
21
23
<h4>\(.name)</h4>
22
24
<p>\(.description)</p>
23
25
</a>"
24
- ) | .[]
26
+ ) | .[]
25
27
'
26
28
}
27
29
28
30
replace_extension_list_partial () {
29
- local -r outfile=" $1 "
30
- local -r infile=" $2 "
31
+ local -r outfile=" $1 "
32
+ local -r infile=" $2 "
31
33
32
- ed -s " $outfile " << EOF
34
+ ed -s " $outfile " << EOF
33
35
/<div class=.nav-cards.>/+,/<.div>/-d
34
36
/<div class=.nav-cards.>/ r $infile
35
37
w
40
42
scriptdir=" $( dirname " $( readlink -f " $0 " ) " ) "
41
43
docfile=" $scriptdir /../docs/sources/next/extensions/explore.md"
42
44
43
- tmpfile=" $( mktemp) "
45
+ tmpfile=" $( mktemp /tmp/extension-registry-changed.XXXXXX ) "
44
46
45
47
generate_extension_list_partial > " $tmpfile "
46
48
replace_extension_list_partial " $docfile " " $tmpfile "
You can’t perform that action at this time.
0 commit comments