Skip to content

Commit

Permalink
remove ref/heads/ from branch name (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
krantideep95 authored Jul 15, 2021
1 parent bb3e4e2 commit 08cefeb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ NA
## Example usage
```yaml
- uses: actions/checkout@v2
- uses: krantideep95/[email protected].0
- uses: razorpay/[email protected].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 }}
Expand Down
9 changes: 6 additions & 3 deletions sparse-checkout.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 /

0 comments on commit 08cefeb

Please sign in to comment.