fjogeleit / yaml-update-action

Update YAML property with dynamic values

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not able to update key which contains dash (-)

ruchir15 opened this issue · comments

HI

I am basically using this action to update a version file .i.e.
when there is a repository dispatch from upstream github repo, I update the version file with service and its version provided in the repo dispatch client payload .i.e.

I have a simple yaml file like below

app1: 22.12.1
app2: 22.12.2
app3-test: 22.12.3

I am able to update this file just fine for key which does not contain dash using it like below

uses: fjogeleit/yaml-update-action@v0.12.2
with:
     valueFile: environments/${{ needs.stack.outputs.name }}/manifest.yaml
      propertyPath: ${{ github.event.client_payload.service }}
      value: ${{ github.event.client_payload.version }}
      branch: versions
      targetBranch: versions
      commitChange: true
       updateFile: true

however when key name contains dash I get this error

 fjogeleit/yaml-update-action@v0.12.2
  with:
    valueFile: environments/development/manifest.yaml
    propertyPath: app3-test
    value: 2.10.0-wzyz
    branch: versions
    targetBranch: versions
    commitChange: true
    message: development: Update  version to 22.10.0-wzyz
    updateFile: true
    masterBranchName: master
    githubAPI: https://api.github.com
    createPR: false
    labels: yaml-updates
    token: ***
    repository: edjx/edjos
    workDir: .
    commitUserName: GitHub Actions
    commitUserEmail: actions@github.com

    
Error: Error: Lexical error on line 1. Unrecognized text.
$.app3-test
-------^

is there a way to even update key which contains dash ?

Able to follow a previously closed issue and was able to resolved using below syntax

propertyPath: .['app3-test']