Skip to content

Commit 555b90a

Browse files
committed
Support default-empty fields.
1 parent 43079ab commit 555b90a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

.github/workflows/render-sample-spec.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
[
1616
{
1717
"src": "sample-spec/spec.ocp",
18-
"append_git_rev_to_version": true,
1918
"gh_pages_html": "sample-spec/HEAD"
2019
}
2120
]

.github/workflows/render.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,22 @@ jobs:
8080
echo '${{ inputs.inputs }}' | jq -c '.[]' | while read -r input; do
8181
src=$(echo "$input" | jq -r '.src')
8282
83+
append_git_rev=$(echo "${input}" | jq 'if .append_git_rev_to_version == true then 1 else 0 end')
84+
85+
gh_pages_html=$(echo "${input}" | jq -e -r '.gh_pages_html') || gh_pages_html=""
86+
gh_pages_pdf=$(echo "${input}" | jq -e -r '.gh_pages_pdf') || gh_pages_pdf=""
87+
8388
src_dirname=$(dirname "${src}")
8489
src_basename=$(basename "${src}")
8590
86-
if echo "${input}" | jq -e '.append_git_rev_to_version' > /dev/null; then
91+
if [ "${append_git_rev}" -eq 1 ]; then
8792
echo "Appending git rev to version string in ${src}"
8893
8994
# `version: 1.3` --> `version: 1.3 (Git commit xyz)`
9095
# `version: "2.0"` --> `version: "2.0 (Git commit xyz)"`
9196
sed -i -r "/^---$/,/^---$/s/^(version: \"?[^\"]*)(\"?)$/\1 (Git commit ${commit_hash})\2/g" "${src}"
9297
fi
9398
94-
gh_pages_html=$(echo "${input}" | jq -e -r '.gh_pages_html') || gh_pages_html=""
9599
if [ -n "${gh_pages_html}" ]; then
96100
echo "Rendering ${src} to gh-pages/${gh_pages_html}/index.html"
97101
@@ -111,7 +115,6 @@ jobs:
111115
mv "${src_dirname}/index.html" "gh-pages/${gh_pages_html}/"
112116
fi
113117
114-
gh_pages_pdf=$(echo "${input}" | jq -e -r '.gh_pages_pdf') || gh_pages_pdf=""
115118
if [ -n "${gh_pages_pdf}" ]; then
116119
# [parent dir name]_[filename sans extension]_[git commit hash].pdf
117120
pdf_name="$(basename "${src_dirname}")_${src_basename%.*}_${commit_hash}.pdf"

0 commit comments

Comments
 (0)