@@ -75,10 +75,48 @@ jobs:
7575 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7676 REPOSITORY : ${{ github.repository }}
7777 LINK_TO_PROFILE : " True"
78- - name : Rename contributor file
78+ OUTPUT_FILENAME : " CONTRIBUTORS.md"
79+ - name : Relint contributor file
80+ # This wraps naked markdown links by the more correct "<...>" form.
7981 run : |
8082 rm -rf contributors.json
81- mv contributors.md CONTRIBUTORS.md
83+ sed -i -E 's/([[:space:]]+)(https:\/\/[^ ]+)/\1<\2>/' CONTRIBUTORS.md
84+ - name : Propagate to other contributors documentation
85+ if : ${{ hashFiles('docs/**/CONTRIBUTORS.md') != '' }}
86+ run : |
87+ # extract the body of updated contributors from ./CONTRIBUTORS.md
88+ body=$(awk '
89+ BEGIN { found = 0; skip_blank = 0 }
90+ !found && /^# / { found = 1; skip_blank = 1; next }
91+ found && skip_blank && /^$/ { skip_blank = 0; next }
92+ found { skip_blank = 0; print }
93+ ' "./CONTRIBUTORS.md")
94+
95+ mapfile -d '' -t files < <(find docs -type f -name CONTRIBUTORS.md -print0)
96+ for file in "${files[@]}"; do
97+ # extract the frontmatter and other leading notes from the document before appending updated contributions.
98+ header=$(awk '
99+ BEGIN { found_heading = 0; in_body = 0 }
100+ /^## / { found_heading = 1; print; next }
101+ found_heading && !in_body {
102+ # Blank line right after heading: print it and start looking at body
103+ if (/^$/) { print; in_body = 1; next }
104+ # Non-blank line right after heading: still part of heading block
105+ print; next
106+ }
107+ in_body {
108+ # First blank line after body paragraph: stop
109+ if (/^$/) exit
110+ print; next
111+ }
112+ { print }
113+ ' "${file}")
114+ {
115+ echo "${header}"
116+ echo ""
117+ echo "${body}"
118+ } > "${file}"
119+ done
82120 - name : Configure bot credentials
83121 uses : go-openapi/gh-actions/ci-jobs/bot-credentials@23cdaeff454807ac293a6e98cff552a2ea49be63 # v1.4.7
84122 id : bot-credentials
0 commit comments