Skip to content

Commit

Permalink
fix: git URI matching for GitHub fallback (#30)
Browse files Browse the repository at this point in the history
* Only remap upstream to github if it does not look like a valid git URI

This allows the user to use this action to pull a glitch.com repo to github as they too do not use the .git suffix

Co-authored-by: Wei He <[email protected]>
  • Loading branch information
notorious-gay and wei authored Sep 3, 2020
1 parent 32f5a76 commit 4c75501
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion github-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ if [[ -z "$BRANCH_MAPPING" ]]; then
exit 1
fi

if ! echo $UPSTREAM_REPO | grep '\.git'
if ! echo $UPSTREAM_REPO | grep -Eq ':|@|\.git\/?$'
then
echo "UPSTREAM_REPO does not seem to be a valid git URI, assuming it's a GitHub repo"
echo "Originally: $UPSTREAM_REPO"
UPSTREAM_REPO="https://github.com/${UPSTREAM_REPO}.git"
echo "Now: $UPSTREAM_REPO"
fi

echo "UPSTREAM_REPO=$UPSTREAM_REPO"
Expand Down

0 comments on commit 4c75501

Please sign in to comment.