Skip to content

Commit

Permalink
CONFIG: remove origin if exists, re add it
Browse files Browse the repository at this point in the history
  • Loading branch information
UmairJibran authored May 21, 2023
1 parent feb5acd commit dfe3dcd
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@ runs:
git init
echo "SETTING DEFAULT BRANCH"
git branch -m $BRANCH
echo "SETTING UP GIT REMOTE"
git remote add origin https://${{ github.repository_owner }}:${{ env.GITHUB_PAT }}@github.com/${{ github.repository }}.git
else
echo "REPO URL: https://${{ github.repository_owner }}:<PAT GOES HERE>@github.com/${{ github.repository }}.git"
echo "SETTING ORIGIN FOR PRE EXISTING REPO"
git remote set-url origin https://${{ github.repository_owner }}:${{ env.GITHUB_PAT }}@github.com/${{ github.repository }}.git
echo "REMOVING REMOTE ORIGIN FOR PRE EXISTING REPO"
git remote remove origin
fi
echo "SETTING UP GIT REMOTE ORIGIN"
git remote add origin https://${{ github.repository_owner }}:${{ env.GITHUB_PAT }}@github.com/${{ github.repository }}.git
git fetch
if ! git ls-remote --exit-code --heads origin ${{ env.TARGET_BRANCH }} >/dev/null 2>&1; then
echo "CHECKING OUT \`$BRANCH\`"
Expand Down

0 comments on commit dfe3dcd

Please sign in to comment.