{"id":26705194,"url":"https://github.com/iamthenoah/gh-action-update-json","last_synced_at":"2026-02-13T05:45:44.877Z","repository":{"id":271222888,"uuid":"870096625","full_name":"iamthenoah/gh-action-update-json","owner":"iamthenoah","description":"GitHub Action for updating key-value pairs in JSON files and committing changes to your repository.","archived":false,"fork":false,"pushed_at":"2025-03-04T09:58:46.000Z","size":379,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-04T10:39:14.580Z","etag":null,"topics":["automation","cicd","json","workflow"],"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/iamthenoah.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":"2024-10-09T12:42:52.000Z","updated_at":"2025-03-04T09:58:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"d2cc6f03-75e6-4620-b8d3-431a7412443d","html_url":"https://github.com/iamthenoah/gh-action-update-json","commit_stats":null,"previous_names":["iamthenoah/gh-action-update-json"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamthenoah%2Fgh-action-update-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamthenoah%2Fgh-action-update-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamthenoah%2Fgh-action-update-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamthenoah%2Fgh-action-update-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamthenoah","download_url":"https://codeload.github.com/iamthenoah/gh-action-update-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245791922,"owners_count":20672666,"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":["automation","cicd","json","workflow"],"created_at":"2025-03-27T05:33:33.222Z","updated_at":"2026-02-13T05:45:44.871Z","avatar_url":"https://github.com/iamthenoah.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![deploy](https://github.com/iamthenoah/update-json-file/actions/workflows/build.yml/badge.svg)](https://github.com/iamthenoah/update-json-file/actions/workflows/build.yml)\n[![publish](https://github.com/iamthenoah/gh-action-update-json/actions/workflows/publish.yml/badge.svg)](https://github.com/iamthenoah/gh-action-update-json/actions/workflows/publish.yml)\n\n# Update JSON File Workflow\n\nThis GitHub Actions workflow updates a specified key in a JSON file and commits the changes to a specified branch.\n\n## Description\n\nThe workflow takes a JSON file path, a key to update, and the new value. It can optionally commit the changes to a specified branch with a customizable commit message.\n\n## Usage\n\nTo use this workflow, add it to your GitHub Actions configuration.\n\n### Inputs\n\n| **Input** | **Description**                                                                 | **Required** | **Default**                     |\n|-----------|---------------------------------------------------------------------------------|--------------|---------------------------------|\n| `file`    | Relative path of the JSON file to update from the root of the repo.             | Yes          | —                               |\n| `key`     | The key in the JSON file to update (e.g. `my.nested.key`).                      | Yes          | —                               |\n| `value`   | The new value to assign to the specified key.                                   | Yes          | —                               |\n| `commit`  | Whether to commit the changes.                                                  | No           | `'true'`                        |\n| `branch`  | Branch to commit the changes to. Defaults to the current branch if unspecified. | No           | _current branch_                |\n| `message` | Commit message. Supports placeholders: `%f` = file, `%k` = key, `%v` = value.   | No           | `'Updated %f with %k:%v.'`      |\n| `name`    | Commit author name.                                                             | No           | `'Github Workflow'`             |\n| `email`   | Commit author email.                                                            | No           | `'noreply@github-workflow.com'` |\n\n### Example\n\nHere’s an example of how to configure the workflow in your GitHub Actions file to update :\n\n```yaml\nname: Update package.json version\n\non:\n  push:\n    tags:\n      - 'v*'\n\njobs:\n  update-package-version:\n    runs-on: ubuntu-latest\n\n    permissions:\n      contents: write\n\n    steps:\n      - name: Checkout repository\n        uses: actions/checkout@v4\n        with:\n          token: ${{ secrets.GITHUB_TOKEN }}\n\n      - name: Update Package Json version\n        uses: iamthenoah/gh-action-update-json@v4\n        with:\n          # The 'file' input specifies the relative path of the JSON file to update from the root.\n          # Default: None, Required: true\n          file: './package.json'\n\n          # The 'key' input is the key in the JSON file to update (e.g., 'my.nested.key').\n          # Default: None, Required: true\n          key: 'version'\n\n          # The 'value' input specifies the value to set for the key.\n          # Default: None, Required: true\n          value: ${{ github.ref_name }}\n\n          # The 'branch' input specifies the branch to commit changes to.\n          # Default: '', Required: false\n          branch: 'master'\n\n          # The 'message' input is the custom commit message format.\n          # Default: 'Updated %f with `%k:%v`.', Required: false\n          message: 'Updated %f version to `%v`'\n\n          # The 'name' input specifies the name shown as the commit sender.\n          # Default: 'Github Workflow', Required: false\n          name: 'My Workflow'\n\n          # The 'email' input sets the email of the committer.\n          # Default: 'noreply@github-workflow.com', Required: false\n          email: 'workflow@example.com'\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required\n```\n\n## Permissions\n\nThis workflow requires elevated permissions in order to commit changes to a repositry. To account for this, add the following in the root of the workflow or job:\n\n```yaml\npermissions:\n  contents: write\n```\n\n## License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamthenoah%2Fgh-action-update-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamthenoah%2Fgh-action-update-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamthenoah%2Fgh-action-update-json/lists"}