Merge pull request #14 from ahmedali8/ci/add-description-in-package-json
ci: auto update description in package.json on repo creation if avail…
This commit is contained in:
commit
99c2acbc72
|
@ -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
|
||||
`
|
||||
|
||||
|
|
|
@ -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: |
|
||||
|
|
Loading…
Reference in New Issue