From 274f1a3498b0220ce5e7df7ad8f08f52e4fd03a4 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Fri, 5 Sep 2025 18:46:29 +0200 Subject: [PATCH] refactor: :hammer: contributor script outputs text, output to file with justfile --- justfile | 2 +- template/justfile.jinja | 2 +- template/tools/get-contributors.sh | 8 +++++--- tools/get-contributors.sh | 8 +++++--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/justfile b/justfile index f5dbea1..09a681e 100644 --- a/justfile +++ b/justfile @@ -70,4 +70,4 @@ build-readme: # Generate a Quarto include file with the contributors build-contributors: - sh ./tools/get-contributors.sh seedcase-project/template-python-project + sh ./tools/get-contributors.sh seedcase-project/template-python-project > docs/includes/_contributors.qmd diff --git a/template/justfile.jinja b/template/justfile.jinja index ac39c56..a1c7c3d 100644 --- a/template/justfile.jinja +++ b/template/justfile.jinja @@ -114,7 +114,7 @@ build-readme: # Generate a Quarto include file with the contributors build-contributors: - sh ./tools/get-contributors.sh {{ github_repo_spec }} + sh ./tools/get-contributors.sh {{ github_repo_spec }} >> docs/includes/_contributors.qmd # Check for and apply updates from the template update-from-template: diff --git a/template/tools/get-contributors.sh b/template/tools/get-contributors.sh index 40aea37..7918505 100644 --- a/template/tools/get-contributors.sh +++ b/template/tools/get-contributors.sh @@ -7,12 +7,14 @@ # - Removes any usernames with the word "bot" in them. # - Removes the trailing comma from the list. repo_spec=${1} -echo "These are the people who have contributed by submitting changes through pull requests :tada:\n\n" > _contributors.qmd -gh api \ +contributors=$(gh api \ -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ /repos/$repo_spec/contributors \ --template '{{range .}} [\@{{.login}}]({{.html_url}}){{"\n"}}{{end}}' | \ grep -v "\[bot\]" | \ tr '\n' ', ' | \ - sed -e 's/,$//' >> _contributors.qmd + sed -e 's/,$/\n/' +) + +echo "The following people have contributed to this project by submitting pull requests :tada:\n\n${contributors}" diff --git a/tools/get-contributors.sh b/tools/get-contributors.sh index 40aea37..7918505 100644 --- a/tools/get-contributors.sh +++ b/tools/get-contributors.sh @@ -7,12 +7,14 @@ # - Removes any usernames with the word "bot" in them. # - Removes the trailing comma from the list. repo_spec=${1} -echo "These are the people who have contributed by submitting changes through pull requests :tada:\n\n" > _contributors.qmd -gh api \ +contributors=$(gh api \ -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ /repos/$repo_spec/contributors \ --template '{{range .}} [\@{{.login}}]({{.html_url}}){{"\n"}}{{end}}' | \ grep -v "\[bot\]" | \ tr '\n' ', ' | \ - sed -e 's/,$//' >> _contributors.qmd + sed -e 's/,$/\n/' +) + +echo "The following people have contributed to this project by submitting pull requests :tada:\n\n${contributors}"