diff --git a/README.md b/README.md index 7dfc370..512b090 100644 --- a/README.md +++ b/README.md @@ -48,11 +48,11 @@ NA ## Example usage ```yaml - uses: actions/checkout@v2 -- uses: krantideep95/proto-api-docs-action@v0.2.0 +- uses: razorpay/proto-api-docs-action@v0.2.2 with: GIT_TOKEN: ${{ secrets.GIT_TOKEN }} PROTO_REPOSITORY: krantideep95/proto - PROTO_BRANCH: test + PROTO_BRANCH: ${{ github.ref }} MODULE_LIST_FILE_PATH: scripts/proto_modules AWS_S3_BUCKET: apidocs AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} diff --git a/sparse-checkout.sh b/sparse-checkout.sh index 8eb8603..92dc363 100755 --- a/sparse-checkout.sh +++ b/sparse-checkout.sh @@ -1,7 +1,10 @@ #!/bin/bash -set -euo pipefail +set -euox pipefail IFS=$'\n\t' +# remove ref/head from $INPUT_PROTO_BRANCH +BRANCH_NAME=$(echo ${INPUT_PROTO_BRANCH#refs/heads/}) + mkdir -p /proto cd /proto git init @@ -10,7 +13,7 @@ git config core.sparseCheckout true GIT_TOKEN=$INPUT_GIT_TOKEN cp $GITHUB_WORKSPACE/${INPUT_MODULE_LIST_FILE_PATH} .git/info/sparse-checkout git remote add origin https://${INPUT_GIT_TOKEN}@github.com/${INPUT_PROTO_REPOSITORY} -git -c protocol.version=2 fetch --no-tags --prune --progress --depth=1 origin ${INPUT_PROTO_BRANCH} -git checkout --progress --force -B ${INPUT_PROTO_BRANCH} origin/${INPUT_PROTO_BRANCH} +git -c protocol.version=2 fetch --no-tags --prune --depth=1 origin ${BRANCH_NAME} +git checkout --force -B ${BRANCH_NAME} origin/${BRANCH_NAME} cd /