Эх сурвалжийг харах

ci: use GitHub env vars instead of contexts

Paul Razvan Berg 2 жил өмнө
parent
commit
43183255f0

+ 7 - 7
.github/scripts/rename.sh

@@ -4,17 +4,17 @@
 set -euo pipefail
 
 # Define the input vars
-REPOSITORY=${1?Error: Please pass username/repo, e.g. prb/hardhat-template}
-REPOSITORY_OWNER=${2?Error: Please pass username, e.g. prb}
+GITHUB_REPOSITORY=${1?Error: Please pass username/repo, e.g. prb/hardhat-template}
+GITHUB_REPOSITORY_OWNER=${2?Error: Please pass username, e.g. prb}
 
-echo "REPOSITORY: $REPOSITORY"
-echo "REPOSITORY_OWNER: $REPOSITORY_OWNER"
+echo "GITHUB_REPOSITORY: $GITHUB_REPOSITORY"
+echo "GITHUB_REPOSITORY_OWNER: $GITHUB_REPOSITORY_OWNER"
 
 # jq is like sed for JSON data
 JQ_OUTPUT=`jq \
-  --arg NAME "@$REPOSITORY" \
-  --arg AUTHOR_NAME "$REPOSITORY_OWNER" \
-  --arg URL "https://github.com/$REPOSITORY_OWNER" \
+  --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 )' \
   package.json
 `

+ 1 - 4
.github/workflows/create.yml

@@ -19,10 +19,7 @@ jobs:
         uses: "actions/checkout@v3"
 
       - name: "Update package.json"
-        env:
-          REPOSITORY: ${{ github.repository }}
-          REPOSITORY_OWNER: ${{ github.repository_owner }}
-        run: ./.github/scripts/rename.sh "$REPOSITORY" "$REPOSITORY_OWNER"
+        run: ./.github/scripts/rename.sh "$GITHUB_REPOSITORY" "$GITHUB_REPOSITORY_OWNER"
 
       - name: "Add rename summary"
         run: |