{"id":13601247,"url":"https://github.com/fjogeleit/yaml-update-action","last_synced_at":"2025-05-16T04:05:12.219Z","repository":{"id":39239414,"uuid":"312927179","full_name":"fjogeleit/yaml-update-action","owner":"fjogeleit","description":"Update YAML property with dynamic values","archived":false,"fork":false,"pushed_at":"2024-12-18T10:29:34.000Z","size":3978,"stargazers_count":152,"open_issues_count":7,"forks_count":51,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-10T19:36:05.429Z","etag":null,"topics":["actions","ci","configuration","continuous-integration","docker","helm","json","yaml"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fjogeleit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-15T00:18:58.000Z","updated_at":"2025-04-10T18:05:52.000Z","dependencies_parsed_at":"2024-01-14T15:24:06.485Z","dependency_job_id":"75009633-674e-4613-bb79-0268d1ba4166","html_url":"https://github.com/fjogeleit/yaml-update-action","commit_stats":{"total_commits":511,"total_committers":13,"mean_commits":39.30769230769231,"dds":"0.16242661448140905","last_synced_commit":"fe7ca6ac478301cbc0bb4303042bde10417b77af"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjogeleit%2Fyaml-update-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjogeleit%2Fyaml-update-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjogeleit%2Fyaml-update-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjogeleit%2Fyaml-update-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fjogeleit","download_url":"https://codeload.github.com/fjogeleit/yaml-update-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254350012,"owners_count":22056453,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","ci","configuration","continuous-integration","docker","helm","json","yaml"],"created_at":"2024-08-01T18:00:59.291Z","updated_at":"2025-05-16T04:05:12.177Z","avatar_url":"https://github.com/fjogeleit.png","language":"TypeScript","funding_links":[],"categories":["actions","docker"],"sub_categories":[],"readme":"# YAML Update Action\n\nUpdate values in an existing YAML or JSON File. Push this updated File to an existing branch or create a new branch. Open a PullRequest to a configurable targetBranch. It is also possible to change the file locally without committing the change.\n\n\n## Use Cases\n\n### Change a local YAML file without committing the change\n\nWith the latest release, the content of your actual file will be updated by default. So, you just need to skip the commit of your change.\n\n```yaml\nname: 'workflow'\non:\n  push:\n    branches:\n      - main\n\njobs:\n  test-update-file:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n      - name: Update values.yaml\n        uses: fjogeleit/yaml-update-action@main\n        with:\n          valueFile: 'file.yaml'\n          propertyPath: 'file.version'\n          value: v1.0.1\n          commitChange: false\n```\n\n### Update Helm Chart after a new Docker Image was build\n\nUpdate the image version configuration inside of my helm `values.yaml` after the related GitHub Workflow build and pushed a new version of my Docker Image to the GitHub Package Registry.\n\n```yaml\nenv:\n  IMAGE_NAME: image\n\njobs:\n  push:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n\n      - name: Build app image\n        run: docker build . --tag image\n\n      - name: Log into registry\n        run: echo \"${{ secrets.GITHUB_TOKEN }}\" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin\n\n      - name: Push app image\n        id: image\n        run: |\n          IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$FILES_IMAGE_NAME\n          # Strip git ref prefix from version\n          VERSION=$(echo \"${{ github.ref }}\" | sed -e 's,.*/\\(.*\\),\\1,')\n          # Strip \"v\" prefix from tag name\n          [[ \"${{ github.ref }}\" == \"refs/tags/\"* ]] \u0026\u0026 VERSION=$(echo $VERSION | sed -e 's/^v//')\n          # Use Docker `latest` tag convention\n          [ \"$VERSION\" == \"main\" ] \u0026\u0026 VERSION=$(echo ${{ github.sha }} | cut -c1-8)\n          echo IMAGE_ID=$IMAGE_ID\n          echo VERSION=$VERSION\n          docker tag image $IMAGE_ID:$VERSION\n          docker push $IMAGE_ID:$VERSION\n          echo \"::set-output name=version::$VERSION\"\n\n      - name: Update Image Version in the related HelmChart values.yaml\n        uses: fjogeleit/yaml-update-action@main\n        with:\n          valueFile: 'deployment/helm/values.yaml'\n          propertyPath: 'backend.version'\n          value: ${{ steps.image.outputs.version }}\n          branch: deployment/${{ steps.image.outputs.version }}\n          targetBranch: development\n          createPR: true\n          message: 'Update Image Version to ${{ steps.image.outputs.version }}' \n```\n\n## Input Arguments\n\n### Base Configurations\n\n| Argument     | Description                                                                                                                                                                                                                                                                     | Default                                   |\n|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------|\n| valueFile    | relative path from the Workspace Directory                                                                                                                                                                                                                                      | _required_ Field if `changes` is not used |\n| propertyPath | PropertyPath for the new value, JSONPath supported                                                                                                                                                                                                                              | _required_ Field if `changes` is not used |\n| value        | New value for the related PropertyPath                                                                                                                                                                                                                                          | _required_ Field if `changes` is not used |\n| changes      | Configure changes on multiple values and/or multiple files. Expects all changes as JSON, supported formats are `{\"filepath\":{\"propertyPath\":\"value\"}}` and `{\"propertyPath\":\"value\"}`. If you use the second format, it uses the filepath provided from the `valueFile` intput. |                                           |\n| updateFile   | **(deprecated)** the updated content will be written into the actual file by default                                                                                                                                                                                            | `false`                                   |\n| workDir      | Relative location of the configured `repository`                                                                                                                                                                                                                                | .                                         |                     |\n| format       | Specify the used format parser of your file. WIll be guessed by file extension if not provided and uses YAML as fallback. Supports `YAML` and `JSON`                                                                                                                            |                                           |\n| method       | Configures the processing of none existing properties. Possible values: `CreateOrUpdate`, `Update`, `Create`                                                                                                                                                                    | `CreateOrUpdate`                          |\n| noCompatMode | Removes quotes from reserved words, like Y, N, yes, no, on, etc.                                                                                                                                                                                                                | `false`                                   |\n| quotingType | used quotes for string values in YAML output                                                                                                                                                                                                               | `'`                                   |\n\n#### Methods\n\nDetermine the behavior for none existing properties or array elements.\n\n| Enum           | Description                                                                   |\n|----------------|-------------------------------------------------------------------------------|\n| CreateOrUpdate | Updates existing values or creates them if not available                      |\n| Update         | Updates existing values, skips the change if not                              |\n| Create         | Creates none existing values, skips the change if the property already exists |\n\n### Git related Configurations\n\n| Argument         | Description                                                                                                                                                                                                      | Default                                               |\n|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|\n| commitChange     | Commit the change to __branch__ with the given __message__                                                                                                                                                       | `true`                                                |\n| message          | Commit message for the changed YAML file                                                                                                                                                                         | ''                                                    |\n| labels           | Comma separated list of labels, e.g. \"feature, yaml-updates\"                                                                                                                                                     | 'yaml-updates'                                        |\n| createPR         | Create a PR from __branch__ to __targetBranch__. Use 'true' to enable it                                                                                                                                         | `false`                                                |\n| title            | Custom title for the created Pull Request                                                                                                                                                                        | 'Merge: {{message}}'                                  |\n| description      | Custom description for the created Pull Request                                                                                                                                                                  | ''                                                    |\n| masterBranchName | Branch name of your master branch                                                                                                                                           \n| targetBranch     | Opens a PR from __branch__ to __targetBranch__  if createPR is set to 'true'                                                                                                                                     | `${masterBranchName}`                                              |\n| repository       | The Repository where the YAML file is located and should be updated. You have to checkout this repository too and set the working-directory for this action to the same as the repository. See the example below | ${{github.repository}}                                |\n| branch           | The updated YAML file will be committed to this branch, branch will be created if not exists                                                                                                                     | `${masterBranchName}`                                              |\n| force            | Allows force pushes                                                                                                                                                                                              | `false`                                               |                                     | `master`                                              |\n| githubAPI        | BaseURL for all GitHub REST API requests                                                                                                                                                                         | https://api.github.com                                |\n| token            | GitHub API Token which is used to create the PR, have to have right permissions for the selected repository                                                                                                      | ${{github.token}}                                     |\n| commitUserName   | Name used for the commit user                                                                                                                                                                                    | github-actions[bot]                                   |\n| commitUserEmail  | Email address used for the commit user                                                                                                                                                                           | 41898282+github-actions[bot]@users.noreply.github.com |\n\n### Output\n\n- `commit` Git Commit SHA\n- `pull_request` Git PR Information\n\n## Debug Information\n\nEnable Debug mode to get information about\n\n- YAML parse and update results\n- Git Steps\n\n## Known Issues\n\nIn this first version the updated YAML file will not be patched. It is parsed into JSON, after the update its converted back to YAML. This means that comments and blank lines will be removed in this process and the intend of the updated content can be different to the previous.\n\nBy default, each value will be interpreted as string. To use other kinds of value types you can use the specified YAML tags as shown here: [JS-YAML -Supported YAML types](https://github.com/nodeca/js-yaml#supported-yaml-types). Use this syntax as string, see the [test workflows](https://github.com/fjogeleit/yaml-update-action/blob/main/.github/workflows/test.yml) as example\n\n## Examples\n\n### Multi Value Changes\n\n```yaml\njobs:\n  test-multiple-value-changes:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n      - uses: fjogeleit/yaml-update-action@main\n        with:\n          valueFile: 'deployment/helm/values.yaml'\n          branch: deployment/dev\n          targetBranch: main\n          createPR: 'true'\n          description: Test GitHub Action\n          message: 'Update All Images' \n          title: 'Version Updates '\n          changes: |\n            {\n              \"backend.version\": \"${{ steps.image.outputs.backend.version }}\",\n              \"frontend.version\": \"${{ steps.image.outputs.frontend.version }}\"\n            }\n```\n\n### Multi File Changes\n\n```yaml\njobs:\n  test-multiple-file-changes:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n      - uses: fjogeleit/yaml-update-action@main\n        with:\n          valueFile: 'deployment/helm/values.yaml'\n          branch: deployment/v1.0.1\n          targetBranch: main\n          createPR: 'true'\n          description: Test GitHub Action\n          message: 'Update All Images' \n          title: 'Version Updates '\n          changes: |\n            {\n              \"__tests__/fixtures/values.dev.yaml\": {\n                \"backend.version\": \"v1.0.1\"\n              },\n              \"__tests__/fixtures/values.stage.yaml\": {\n                \"backend.version\": \"v1.0.1\"\n              },\n              \"__tests__/fixtures/values.prod.yaml\": {\n                \"backend.version\": \"v1.0.1\"\n              }\n            }\n```\n\n### Change a YAML Multifile\n\nYaml supports multiple documents in a single file separated by `---`.\nTo update such a file, start the property path with the index of the document to be changed.\n\n```yaml\njobs:\n  test-multifile-changes:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n      - uses: fjogeleit/yaml-update-action@main\n        with:\n          valueFile: 'deployment/helm/values.yaml'\n          branch: deployment/v1.0.1\n          targetBranch: main\n          createPR: 'true'\n          description: Test GitHub Action\n          message: 'Update Images'\n          title: 'Version Updates '\n          changes: |\n            {\n              \"__tests__/fixtures/multivalue.yaml\": {\n                \"[0].backend.version\": \"v1.1.0\",\n                \"[1].containers[1].image\": \"node:alpine\"\n              }\n            }\n```\n\n### Advanced Example with an separate target repository\n\n```yaml\nenv:\n  IMAGE_NAME: image\n\njobs:\n  push:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n        with:\n            path: main\n\n      - name: Build app image\n        run: docker build . --tag image\n        working-directory: ./main\n\n      - name: Log into registry\n        run: echo \"${{ secrets.GITHUB_TOKEN }}\" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin\n\n      - name: Push app image\n        id: image\n        run: |\n          IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$FILES_IMAGE_NAME\n          ....\n          echo \"::set-output name=version::$VERSION\"\n\n      - name: Checkout Target Repository\n        uses: actions/checkout@v3\n        with:\n          repository: owner/target-repository\n          path: infrastructure\n          token: ${{ secrets.GITHUB_TOKEN }} \n\n      - name: Update Image Version in the related HelmChart values.yaml\n        uses: fjogeleit/yaml-update-action@main\n        with:\n          valueFile: 'deployment/helm/values.yaml'\n          propertyPath: 'backend.version'\n          value: ${{ steps.image.outputs.version }}\n          repository: owner/target-repository\n          branch: deployment/${{ steps.image.outputs.version }}\n          targetBranch: development\n          createPR: true\n          message: 'Update Image Version to ${{ steps.image.outputs.version }}'\n          token: ${{ secrets.GITHUB_TOKEN }}\n          workDir: infrastructure\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffjogeleit%2Fyaml-update-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffjogeleit%2Fyaml-update-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffjogeleit%2Fyaml-update-action/lists"}