{"id":13295937,"url":"https://github.com/pyanderson/githasdiff","last_synced_at":"2025-04-21T08:32:12.625Z","repository":{"id":118979168,"uuid":"265099448","full_name":"pyanderson/githasdiff","owner":"pyanderson","description":"Small python script to search for changes using fnmatch patterns. The principal objective is make build processes faster avoiding unnecessary steps.","archived":false,"fork":false,"pushed_at":"2021-07-10T23:45:06.000Z","size":20,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T11:50:32.608Z","etag":null,"topics":["cd","ci","cicd","continuous-deployment","continuous-integration","deploy","deployment","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","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/pyanderson.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-05-19T00:37:01.000Z","updated_at":"2024-06-26T15:13:44.000Z","dependencies_parsed_at":"2023-05-01T01:47:00.871Z","dependency_job_id":null,"html_url":"https://github.com/pyanderson/githasdiff","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyanderson%2Fgithasdiff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyanderson%2Fgithasdiff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyanderson%2Fgithasdiff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyanderson%2Fgithasdiff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyanderson","download_url":"https://codeload.github.com/pyanderson/githasdiff/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250023567,"owners_count":21362424,"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":["cd","ci","cicd","continuous-deployment","continuous-integration","deploy","deployment","python","python3"],"created_at":"2024-07-29T17:18:10.291Z","updated_at":"2025-04-21T08:32:12.328Z","avatar_url":"https://github.com/pyanderson.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# githasdiff\n[![Build Status](https://travis-ci.org/pyanderson/githasdiff.svg?branch=master)](https://travis-ci.org/pyanderson/githasdiff)\n\nSmall python script to search for changes using [fnmatch](https://docs.python.org/3/library/fnmatch.html) patterns to filter `git diff HEAD~`. The principal objective is make build processes faster checking whats changes before build projects/services.\n\n- The script exits with 0 when changes are found and 1 otherwise.\n- If script receives a `command`, it will be executed and exits with `command` exit code.\n\nInspired by [dockerfiles test script](https://github.com/jessfraz/dockerfiles/blob/master/test.sh) from **Jess Frazelle**.\n\n\n## Configuration\nCreate a json file named `.githasdiff.json` with `include` and `exclude` patterns for each project/service/build:\n\n```json\n{\n    \"project_a\": {\n        \"include\": [\n            \"project_a/*.py\"\n        ],\n        \"exclude\": [\n            \"project_a/extra_scripts/*.py\"\n        ]\n    }\n}\n```\n\nGlobal patterns can be defined in same file:\n\n```json\n{\n    \"include\": [\n        \"*.py\"\n    ],\n    \"exclude\": [\n        \"*.md\"\n    ]\n}\n```\n\n### Observations:\n- Global patterns will be always used to search for changes.\n- `exclude` has priority over `include` patterns, so first exclude, then matches.\n- If `include` patterns list is omitted, then script will considerate `[\"*\"]` as `include` list pattern.\n\nIt's also possible use an env var `GITHASDIFF_FILE` to set the path to json config file, and an env var `GITHASDIFF_COMMAND` to set command to check for diff.\n\n## Install\n\n```bash\ncurl -L https://github.com/pyanderson/githasdiff/releases/download/1.0.4/githasdiff \u003e ./githasdiff\nchmod +x ./githasdiff\n```\n\n## Run\n\nUsing if/else:\n\n```bash\nif ./githasdiff project_a; then docker build -t project_a project_a/; else exit 0; fi\n```\n\nUsing the `command` as args:\n\n```bash\n./githasdiff project_a docker build -t project_a project_a/\n```\n\n## Examples\n\nCheck [.githasdiff.json](.githasdiff.json) for configuration and [.travis.yml](.travis.yml) for running.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyanderson%2Fgithasdiff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyanderson%2Fgithasdiff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyanderson%2Fgithasdiff/lists"}