diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6e261a7..41cfa12 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -21,23 +21,26 @@ jobs: - name: Generate Go documentation and update README run: | - go install github.com/robertkrimen/godocdown/godocdown@latest - TEMPFILE=$(mktemp) - godocdown . > $TEMPFILE - if ! grep -q '' README.md; then echo "Error: marker not found in README.md" exit 1 fi - + if ! grep -q '' README.md; then echo "Error: marker not found in README.md" exit 1 fi + + go install github.com/robertkrimen/godocdown/godocdown@latest + TEMPFILE=$(mktemp) + echo "" > $TEMPFILE + godocdown . >> $TEMPFILE + echo "" >> $TEMPFILE + awk -v file="$TEMPFILE" \ - '// { print; while (getline < file) print; next } 1' \ - README.md | awk '// { p = 1 } p; // { p = 0 }' > README.md.new + '//, // { if ($0 ~ //) { while (getline < file) print } else { next } } 1' \ + README.md > README.md.new mv README.md.new README.md