I have a github action where I am logging in to my azure account and I want to add output of azure cli command to github action variable. How do I do this?
This is my github action job
jobs:
StagingBuildAndDeploy:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: 'Login via Azure CLI'
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }
Now I want add output of this command to a variable
az acr repository show-tags --name acrname --repository reponame --orderby time_desc --top 1
This command would fetch me the latest image in acr. How do I add that image name to a github action variable
I tried doing this
- name: Read image_name
id: getimagename
run: echo "::set-output name=image_name::$(az acr repository show-tags --name acrname --repository reponame --orderby time_desc --top 1)"
and then I tried accessing it by this ${{ steps.getimagename.outputs.image_name }}
This is what I was getting as output when I am assigning the value to variable
Run h=$(az acr repository show-tags --name acrname --repository *** --orderby time_desc --top 1)
"tag132"
]
This is what I got when I printed my variable
Run echo "["
[