{"id":16368612,"url":"https://github.com/simoneb/github-ensure-file","last_synced_at":"2026-02-26T21:30:14.682Z","repository":{"id":37085855,"uuid":"445604732","full_name":"simoneb/github-ensure-file","owner":"simoneb","description":"Ensures a file exists across repos of a user or an org in GitHub","archived":false,"fork":false,"pushed_at":"2024-04-04T14:27:07.000Z","size":1063,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-04T15:45:44.974Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simoneb.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}},"created_at":"2022-01-07T17:42:35.000Z","updated_at":"2024-04-15T15:55:01.448Z","dependencies_parsed_at":"2023-02-19T17:46:05.964Z","dependency_job_id":"60914b6a-9d27-4cf5-9d37-82a4a57cd63b","html_url":"https://github.com/simoneb/github-ensure-file","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simoneb%2Fgithub-ensure-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simoneb%2Fgithub-ensure-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simoneb%2Fgithub-ensure-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simoneb%2Fgithub-ensure-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simoneb","download_url":"https://codeload.github.com/simoneb/github-ensure-file/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239869222,"owners_count":19710485,"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":[],"created_at":"2024-10-11T02:53:17.014Z","updated_at":"2026-02-26T21:30:14.248Z","avatar_url":"https://github.com/simoneb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e The license of this software has changed to AWISC - Anti War ISC License\n\n# github-ensure-file\n\nEnsures a file exists across repos of a user or an org in GitHub.\n\n## Setup\n\n```sh\nnpm i github-ensure-file\n```\n\nProvide the `GITHUB_TOKEN` environment variable containing a token with enough permissions to write files to the repositories you'll be working on. You can also use a local `.env` file to provide that variable.\n\nYou can generate a personal access token [here](https://github.com/settings/tokens/new).\n\n## Usage\n\n```sh\ngithub-ensure-file \u003cgithub-user-or-org\u003e \u003cfile-path\u003e\n```\n\n- `github-user-or-org`: name of the GitHub user or organization\n- `file-path`: path to a local file\n\n## How it works\n\n1. It iterates through all the the repositories of the organization\n2. It uses `\u003cfile-path\u003e` to check if a file exists in the repository **at the same path as the local file**\n3. Processing\n   - If the file does not exist in the repo -\u003e it prompts to create it\n   - If the file exists in the repo but its contents are different from the local file -\u003e it prompts to update it\n   - If the file exists and has the same content as the local file -\u003e it continues to the next repo\n\n## Example\n\nIf I wanted to ensure that the file located in this repo at `.github/workflows/ci.yml` existed in other repos in my user account (`@simoneb`) **at the same path** I would do:\n\n```sh\ngithub-ensure-file simoneb .github/workflows/ci.yml\n```\n\nWhich would give me an output similar to:\n\n```sh\nFile does not exist in simoneb/some-repo, create (y/N)?\nFile exists in simoneb/another-repo but is different, update (y/N)?\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimoneb%2Fgithub-ensure-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimoneb%2Fgithub-ensure-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimoneb%2Fgithub-ensure-file/lists"}