Skip to content

Commit b5f529b

Browse files
authored
Generate humans.{txt,md,html} in build
1 parent d575aac commit b5f529b

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

.github/workflows/build.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,22 @@ jobs:
6262
ENDPOINT: '/repos/${{ github.repository }}/contributors'
6363
JQ_QUERY: '"author-meta:" + (["", (.[] | .login)] | join("\n- "))'
6464

65+
- name: "Generate a humans.txt file"
66+
run: gh api "${ENDPOINT}" --template "${TEMPLATE}" | sh | tee humans.txt
67+
env:
68+
ENDPOINT: '/orgs/${{ github.repository_owner }}/repos'
69+
TEMPLATE: |
70+
echo "# Contributors by Repository"
71+
echo
72+
echo "A huge thanks to all and colaborators who have contributed on GitHub!"
73+
echo
74+
{{range .}}
75+
echo "## {{.full_name}}"
76+
echo
77+
gh api '/repos/{{.full_name}}/contributors' --jq '.[].login' | sort -u | xargs -ILOGIN gh api '/users/LOGIN' --jq '"- @" + .login + " (" + (.name // .login) + ")"'
78+
echo
79+
{{end}}
80+
6581
- name: "Generate a changelog.md file"
6682
run: gh api "${ENDPOINT}" --template "${TEMPLATE}" | tee changelog.md
6783
env:
@@ -105,10 +121,18 @@ jobs:
105121
- name: "Create generated HTML files"
106122
run: |
107123
make -f - << \EOF
124+
.PHONY: all text-to-markdown markdown-to-html
108125
109-
all: $(patsubst %.md,%.html,$(wildcard *.md */*.md */*/*.md))
126+
all: text-to-markdown markdown-to-html
110127
rm -f header.html
111128
129+
markdown-to-html: $(patsubst %.md,%.html,$(wildcard *.md */*.md */*/*.md))
130+
131+
text-to-markdown: $(patsubst %.txt,%.md,$(wildcard *.txt */*.txt */*/*.txt))
132+
133+
%.md: %.txt
134+
cp $< $@
135+
112136
%.html: %.md
113137
pandoc --metadata-file=authors.yaml --template=GitHub.html5 --include-in-header=header.html --from markdown+yaml_metadata_block+backtick_code_blocks+fenced_code_attributes+inline_notes+emoji-implicit_figures --to html --standalone $< --output $@
114138
@@ -117,10 +141,13 @@ jobs:
117141
- name: "Create redirect HTML files"
118142
run: |
119143
make -f - << \EOF
144+
.PHONY: all redirect-to-html
120145
121-
all: $(patsubst %.redirect,%.html,$(wildcard *.redirect */*.redirect */*/*.redirect))
146+
all: redirect-to-html
122147
rm -f redirect.html $(wildcard *.redirect */*.redirect */*/*.redirect)
123148
149+
redirect-to-html: $(patsubst %.redirect,%.html,$(wildcard *.redirect */*.redirect */*/*.redirect))
150+
124151
%.html: %.redirect
125152
@echo "Generating $@..."
126153
$(file > $@, $(subst {{ .REDIRECT }},$(file < $<),$(file < redirect.html)))

0 commit comments

Comments
 (0)