{"id":48211023,"url":"https://github.com/techservicesillinois/template-repo-sync","last_synced_at":"2026-04-04T18:48:31.362Z","repository":{"id":329348428,"uuid":"1113338580","full_name":"techservicesillinois/template-repo-sync","owner":"techservicesillinois","description":"Command line tool to compare and synchronize select files against a template repository.","archived":false,"fork":false,"pushed_at":"2026-02-26T21:48:19.000Z","size":26,"stargazers_count":0,"open_issues_count":10,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-27T03:43:34.903Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/techservicesillinois.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-09T20:58:10.000Z","updated_at":"2026-02-26T21:48:16.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/techservicesillinois/template-repo-sync","commit_stats":null,"previous_names":["techservicesillinois/template-repo-sync"],"tags_count":0,"template":false,"template_full_name":"techservicesillinois/secdev-template-repository","purl":"pkg:github/techservicesillinois/template-repo-sync","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techservicesillinois%2Ftemplate-repo-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techservicesillinois%2Ftemplate-repo-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techservicesillinois%2Ftemplate-repo-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techservicesillinois%2Ftemplate-repo-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/techservicesillinois","download_url":"https://codeload.github.com/techservicesillinois/template-repo-sync/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techservicesillinois%2Ftemplate-repo-sync/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31409470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-04-04T18:48:31.258Z","updated_at":"2026-04-04T18:48:31.337Z","avatar_url":"https://github.com/techservicesillinois.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Commands\r\n\r\n### Compare and Update\r\n\r\n`borg` can compare or update a local folder to match a template repository.\r\n\r\nAn expected use case is keeping a code repository in sync with a [GitHub Template Repository][gittemp].\r\nAny web URL containing example files may be used.\r\n\r\n`.borg.toml` tells `borg` where to find the template repository. The template repository must include at least `.borg.template.toml`, which specifies which of the other files available in the template repository should be kept in sync by `borg`. See `Configuration` for more details on configurating `borg`.\r\n\r\n`borg compare` may be used during a CI/CD pipeline to issue a warning if files differ from the template repository. The command `borg compare` will have no output if all specified files match the template repository. If any files differ, they will be listed in the output of `borg compare`, and `borg` will exit with a non-zero exit code.\r\n\r\n`borg update` updates all appropriate files in the local folder to match the template repository, per the configuration in `.borg.template.toml`. `borg update` can be used to resolve CI/CD pipeline warnings issued by `borg compare`. \r\n\r\nUsing the these commands helps ensure that best practice updates made to a template repository consistently reach project repositories.\r\n\r\n[gittemp]: https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-template-repository\r\n\r\n### Generate\r\n\r\n`borg` can generate content for `.gitattributes`, based on the `files` section of the configured `.borg.template.toml`. The generated [gitattributes file][gita] indicates to GitHub that certain files are machine-generated. This causes GitHub to hide the file `diff` during a pull request.\r\n\r\nYou may want to add additional contents after regenerating `.gitattributes`,\r\nas in the `Makefile` example below.\r\n\r\n[gita]: https://git-scm.com/docs/gitattributes) \r\n\r\n\r\n```sh\r\nborg generate .gitattributes\r\n```\r\n\r\nGiven this `.borg.template.toml`:\r\n\r\n```toml\r\n[template]\r\n# Keep these files in sync across Python repos\r\nfiles = [\r\n    \".gitignore\",\r\n    \".github/workflows/pr_reminder.yml\",\r\n    \".github/workflows/cleanup.yml\",\r\n    \"CODE_OF_CONDUCT.md\",\r\n    \"SECURITY.md\",\r\n]\r\n\r\n[generate.gitattributes]\r\nfiles = [\r\n    # All machine generated files\r\n    \".gitattributes\",\r\n    \"requirements*.txt\",\r\n]\r\n# Include all template files above\r\ninclude_template_files = true\r\n```\r\n\r\nwill generate this `.gitattributes` file:\r\n\r\n```sh\r\n# Ignore files managed by borg in Github PR reviews\r\n.gitattributes linguist-generated\r\nrequiements*.txt linguist-generated\r\n.gitignore linguist-generated\r\n.github/workflows/pr_reminder.yml linguist-generated\r\n.github/workflows/cleanup.yml linguist-generated\r\nCODE_OF_CONDUCT.md linguist-generated\r\nSECURITY.md linguist-generated\r\n```\r\n\r\nAnd here is a `Makefile` example, where we append additional data to the `.gitattributes` file after generating it with `borg generate`.\r\n\r\n```makefile\r\n.gitattributes: .borg.toml\r\n\tborg generate $^\r\n\techo 'requirements*.txt linguist-generated' \u003e\u003e $^  # Add additional files to .gitattributes\r\n```\r\n\r\n## Configuration\r\n\r\n### Local configuration\r\n\r\nA file named `.borg.toml` should exist in the directory where `borg` is run.\r\nThis configuration file tells `borg` where to find the templates to compare\r\nthe local directory to.\r\n\r\nSee `.borg.toml` in this directory for an example.\r\n\r\n`url` should point to a web directory containing a `.borg.template.toml` file and all expected files specified in that file.\r\n\r\nAn expected use case is using `raw.githubusercontent` URLs for public GitHub repositories.\r\n\r\nA good way to find this `url` is to navigate to raw file view of `.borg.template.toml`.\r\n\r\nFor example, on GitHub, the raw version of `.borg.template.toml` is at `https://raw.githubusercontent.com/techservicesillinois/secdev-template-repository/refs/heads/main/.borg.template.toml`\r\n```\r\n\r\nAnd so the `.borg.toml` file should contain:\r\n\r\n```\r\n[source]\r\nurl = 'https://raw.githubusercontent.com/techservicesillinois/secdev-template-repository/refs/heads/main/'\r\n```\r\n\r\nIt is also possible to use other GitHub branches for comparison, using a `refs/heads` URL:\r\n\r\n```\r\n[source]\r\n# To compare to an un-merged `doc/python` branch:\r\nurl = 'https://raw.githubusercontent.com/techservicesillinois/secdev-template-python/refs/heads/doc/python/'\r\n```\r\n\r\n\u003e Note: Our typical use case is public templates. But a private repository can be used, by first cloning the private repository, and then calling `borg` with `--source-dir` pointed to the local folder of the clone.\r\n\r\nWhen using `--source-dir`, any `.borg.toml` file is ignored. Template configuration is loaded as usual from the `.borg.template.toml` file in the template repository directory specified by `--source-dir`.\r\n\r\n### Template configuration \r\n\r\nThe remote `url` should contain a file named `.borg.template.toml`.\r\nThis file specifies which of the files available at the remote URL\r\nshould be treated as templates for comparison.\r\n\r\nExample `.borg.template.toml`:\r\n\r\n```\r\n[template]\r\nfiles = [\r\n    \".gitattributes\",\r\n    \".github/workflows/deploy.yml\",\r\n    \".gitignore\",\r\n    \"CODE_OF_CONDUCT.md\",\r\n    \"Makefile\",\r\n    \"SECURITY.md\",\r\n    \"mypy.ini\",\r\n    \"pyproject.toml\",\r\n    \"tests/test_python_version.py\",\r\n]\r\n```\r\n\r\n### Overriding `.borg.template.toml` with `.borg.toml`\r\n\r\nIf a file specified by `.borg.template.toml` in the template repository should\r\nnot be synced; it can be added to `skip_files` in the `template` section of\r\nthe local `.borg.toml` file.\r\n\r\nWith the following in `.borg.toml`, `.gitignore` will not be compared or updated,\r\neven if specified in the template repository `.borg.template.toml`:\r\n\r\n```toml\r\n[template]\r\nskip_files = [\r\n    \".gitignore\",\r\n]\r\n```\r\n\r\n## Data Sources\r\n\r\n|Data Store|Data Type|Sensitivity|Notes|\r\n|----------|---------|-----------|-----|\r\n| A remote template URL | Text | Public | This URL is specified in `.borg.toml` |\r\n\r\n## Endpoint Connections\r\n\r\nNo endpoints. The outputs of this this tool are managed through a separate dedicated tool, such as `git`.\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechservicesillinois%2Ftemplate-repo-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechservicesillinois%2Ftemplate-repo-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechservicesillinois%2Ftemplate-repo-sync/lists"}