{"id":26993273,"url":"https://github.com/onlyutkarsh/patch-files-action","last_synced_at":"2025-04-03T23:17:52.695Z","repository":{"id":42896518,"uuid":"251420562","full_name":"onlyutkarsh/patch-files-action","owner":"onlyutkarsh","description":"A GitHub action to patch JSON files.","archived":false,"fork":false,"pushed_at":"2023-01-09T07:45:48.000Z","size":319,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T09:42:34.314Z","etag":null,"topics":["actions","json"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/patch-files","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/onlyutkarsh.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}},"created_at":"2020-03-30T20:27:00.000Z","updated_at":"2023-12-27T14:00:30.000Z","dependencies_parsed_at":"2023-01-11T17:22:18.686Z","dependency_job_id":null,"html_url":"https://github.com/onlyutkarsh/patch-files-action","commit_stats":{"total_commits":55,"total_committers":2,"mean_commits":27.5,"dds":"0.21818181818181814","last_synced_commit":"dea72ee5a1b646f9d7c652c1c8aff65cdf425b58"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onlyutkarsh%2Fpatch-files-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onlyutkarsh%2Fpatch-files-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onlyutkarsh%2Fpatch-files-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onlyutkarsh%2Fpatch-files-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onlyutkarsh","download_url":"https://codeload.github.com/onlyutkarsh/patch-files-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247092384,"owners_count":20882218,"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","json"],"created_at":"2025-04-03T23:17:52.259Z","updated_at":"2025-04-03T23:17:52.680Z","avatar_url":"https://github.com/onlyutkarsh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Patch files\n\nA simple action to patch JSON files.\n\n\u003e Only JSON files are supported at the moment. Support for other file types is planned in the later versions.\n\n## Inputs\n\n- `files`\n   \n   Glob expression. See example action YAML below. *Required.*\n\n- `patch-syntax` \n    \n    Use the `operation syntax =\u003e value` syntax to patch the JSON file. *Required.* \n\n    Supported Operations:\n    - `+` add. Example:  `+ /version =\u003e \"1.0.0\"`\n    - `-` remove. Example: `- /version` **Note:** No value is passed.\n    - `=` replace. Example: `= /version =\u003e \"1.0.1\"`\n\n    **Example**:\n    \n    Input JSON:\n    ```json\n    {\n        \"version\": \"1.0.0\",\n        \"keywords\": [],\n        \"bugs\": {\n            \"url\": \"http://www.dummy.com\"\n        }\n    }\n    ```\n    Patch Syntax:\n    ```yaml\n    patch-syntax: |\n          = /version =\u003e \"1.0.1\"\n          + /author =\u003e \"John Smith\"\n          = /bugs/url =\u003e \"https://www.mydomain.com\"\n    ```\n    Output JSON:\n    ```json\n    {\n        \"version\": \"1.0.1\",\n        \"keywords\": [],\n        \"author\": \"John Smith\",\n        \"bugs\": {\n            \"url\": \"https://www.mydomain.com\"\n        }\n    }\n    ```\n- `output-patched-file`\n\n    If `true`, the patched content is printed in the logs. *Optional. Default is `true`*. \n\n- `fail-if-no-files-patched`\n\n    If `true`, fails the build, if no files are patched. *Optional. Default is `false`*. \n\n- `fail-if-error`\n\n    If `true`, failes the build when an error occurrs. *Optional. Default is `false`* \n\n## Sample action\n\n```yaml\n\nname: \"test action\"\non:\n  pull_request:\n  push:\n    branches:\n      - master\n      - 'feature/*'\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v1\n\n    - name: Patch files\n      uses: onlyutkarsh/patch-files-action@v1.0.1\n      env:\n        name: utkarsh\n      with:\n        files: |\n          testfiles/**/*.json\n        patch-syntax: |\n          = /version =\u003e \"1.0.1\"\n          + /author =\u003e \"${{ env.name }}\"\n          = /bugs/url =\u003e \"https://www.google.com\"\n          + /buildId =\u003e \"${{ github.run_number }}\"\n\n```\n\n## Acknowledgment\n\n- Inspired from https://marketplace.visualstudio.com/items?itemName=geeklearningio.gl-vsts-tasks-file-patch task for Azure Pipelines\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonlyutkarsh%2Fpatch-files-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonlyutkarsh%2Fpatch-files-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonlyutkarsh%2Fpatch-files-action/lists"}