mbsouksu
mbsouksu

Reputation: 108

Get the name of variable from a JSON file in GitHub Actions

I am trying to setup the GitHub actions for deployment to the Azure. What I am trying to do is getting the name of some variables from the armtemplates with the given code.

name: Create Initial Resources

on:
  push:
    branches:
      - CreateResources

jobs:

  Read:
    runs-on: ubuntu-latest
    steps:
      - name: Chekout branch
        uses: actions/checkout@v2
        with:
          ref: CreateResources
      
      - name: get storage account
        run: |
              echo ::set-output name=storage-account-name::$(jq '.parameters.storage_account_name.value' at ./armtemplates/sac/parameters-example.json)

This is the code that I use, first it checks the branch and in the second step it tries to parse the file that is in the branch but the error is like this:

jq: error: Could not open file at: No such file or directory

Upvotes: 0

Views: 452

Answers (1)

Krzysztof Madej
Krzysztof Madej

Reputation: 40711

Issue here is at phrase. Please use this:

echo ::set-output name=storage-account-name::$(jq '.parameters.storage_account_name.value' ./armtemplates/sac/parameters-example.json)

Upvotes: 2

Related Questions