diff --git a/.github/scripts/rename.sh b/.github/scripts/rename.sh index db74241..62e37dd 100755 --- a/.github/scripts/rename.sh +++ b/.github/scripts/rename.sh @@ -6,16 +6,19 @@ set -euo pipefail # Define the input vars GITHUB_REPOSITORY=${1?Error: Please pass username/repo, e.g. prb/foundry-template} GITHUB_REPOSITORY_OWNER=${2?Error: Please pass username, e.g. prb} +GITHUB_REPOSITORY_DESCRIPTION=${3:-""} # If null then replace with empty string echo "GITHUB_REPOSITORY: $GITHUB_REPOSITORY" echo "GITHUB_REPOSITORY_OWNER: $GITHUB_REPOSITORY_OWNER" +echo "GITHUB_REPOSITORY_DESCRIPTION: $GITHUB_REPOSITORY_DESCRIPTION" # jq is like sed for JSON data JQ_OUTPUT=`jq \ --arg NAME "@$GITHUB_REPOSITORY" \ --arg AUTHOR_NAME "$GITHUB_REPOSITORY_OWNER" \ --arg URL "https://github.com/$GITHUB_REPOSITORY_OWNER" \ - '.name = $NAME | .description = "" | .author |= ( .name = $AUTHOR_NAME | .url = $URL )' \ + --arg DESCRIPTION "$GITHUB_REPOSITORY_DESCRIPTION" \ + '.name = $NAME | .description = $DESCRIPTION | .author |= ( .name = $AUTHOR_NAME | .url = $URL )' \ package.json ` diff --git a/.github/workflows/create.yml b/.github/workflows/create.yml index d16c631..66417a9 100644 --- a/.github/workflows/create.yml +++ b/.github/workflows/create.yml @@ -17,7 +17,10 @@ jobs: uses: "actions/checkout@v3" - name: "Update package.json" - run: ./.github/scripts/rename.sh "$GITHUB_REPOSITORY" "$GITHUB_REPOSITORY_OWNER" + env: + GITHUB_REPOSITORY_DESCRIPTION: ${{ github.event.repository.description }} + run: + ./.github/scripts/rename.sh "$GITHUB_REPOSITORY" "$GITHUB_REPOSITORY_OWNER" "$GITHUB_REPOSITORY_DESCRIPTION" - name: "Add rename summary" run: |