We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to get the remote-url as an env variable in my ssh-action step. What I tried so far:
name: Azure VM deploy # test deploy Azure on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - name: Check out code uses: actions/checkout@v2 - name: Environment variables run: | echo "GURL=$(git remote get-url origin)" >> $GITHUB_ENV - name: Create project dir uses: appleboy/ssh-action@master env: MYGURL: ${{ github.GURL }} with: HOST: ${{ secrets.AZURE_HOST }} USERNAME: ${{ secrets.AZURE_USERNAME }} KEY: ${{ secrets.AZURE_KEY }} PORT: ${{ secrets.PORT }} ENVS: MYGURL script: | mkdir -p ~/projects echo "$MYGURL" cd ~/projects if [ -d "${{ github.event.repository.name }}" ]; then echo "Directory already exists" cd ${{ github.event.repository.name }} git pull --rebase else echo "Project does not exist, cloning.." git clone $MYGURL fi echo 'Deployment to Azure succesful!'
But this does not seem to work since echo "$MUGURL" gives an empty string. Is there a way to achieve what I want with ssh-action?
echo "$MUGURL"
The final goal is to make line git clone $MYGURL work in some way. So we have to get the remote repo url in a general way.
git clone $MYGURL
The text was updated successfully, but these errors were encountered:
@erfannariman The best way to do this is to build the clone URL yourself, something like this (untested):
uses: appleboy/ssh-action@master env: REPO: ${{ github.repository }} # e.g. "appleboy/ssh-action" TOKEN: ${{ github.token }} with: envs: REPO,TOKEN script: | git clone https://$TOKEN@github.com/$REPO.git
See https://github.blog/2012-09-21-easier-builds-and-deployments-using-git-over-https-and-oauth/ for why this URL works.
Sorry, something went wrong.
No branches or pull requests
I want to get the remote-url as an env variable in my ssh-action step. What I tried so far:
But this does not seem to work since
echo "$MUGURL"
gives an empty string. Is there a way to achieve what I want with ssh-action?The final goal is to make line
git clone $MYGURL
work in some way. So we have to get the remote repo url in a general way.The text was updated successfully, but these errors were encountered: