{"id":17984067,"url":"https://github.com/wlun001/path-change","last_synced_at":"2026-05-03T16:31:33.085Z","repository":{"id":133432567,"uuid":"464525349","full_name":"WLun001/path-change","owner":"WLun001","description":"⚠️ Depracated - A server to detect path changes based on glob pattern based on last commit","archived":false,"fork":false,"pushed_at":"2023-09-22T05:52:45.000Z","size":127,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-09T13:41:35.796Z","etag":null,"topics":["cicd","cluster-interceptor","diff","docker","example","gitwebhook","glob","glob-pattern","golang","kubernetes","path-change","paths","tekton","tekton-pipelines","tekton-triggers","tektoncd","triggers","webhook","webhooks-catcher"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WLun001.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-02-28T14:56:34.000Z","updated_at":"2023-09-21T06:40:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"fc965872-11e8-4ca5-b356-82337db13dd4","html_url":"https://github.com/WLun001/path-change","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WLun001%2Fpath-change","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WLun001%2Fpath-change/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WLun001%2Fpath-change/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WLun001%2Fpath-change/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WLun001","download_url":"https://codeload.github.com/WLun001/path-change/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247107827,"owners_count":20884797,"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":["cicd","cluster-interceptor","diff","docker","example","gitwebhook","glob","glob-pattern","golang","kubernetes","path-change","paths","tekton","tekton-pipelines","tekton-triggers","tektoncd","triggers","webhook","webhooks-catcher"],"created_at":"2024-10-29T18:19:22.167Z","updated_at":"2026-05-03T16:31:28.057Z","avatar_url":"https://github.com/WLun001.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ⚠️ Depracated in flavour of [changed files](https://tekton.dev/docs/triggers/interceptors/#adding-changed-files)\n\n# Path Change server\n\n### Summary\n\nA server for CI/CD pipelines to detect file change based on last commit,\nwith [glob pattern](https://github.com/bmatcuk/doublestar#patterns), compatible\nwith [Tekton ClusterInterceptor](https://tekton.dev/docs/triggers/clusterinterceptors/#configuring-a-kubernetes-service-for-the-clusterinterceptor)\n.\n\nThe behaviour will be similar\nto [github actions paths](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-including-paths)\nand [cloud build includeFile](https://cloud.google.com/build/docs/automating-builds/create-manage-triggers#build_trigger)\n. Only trigger build when the file changes match the patterns\n\nNot all CI server/service support file change detection feature. This project will make this available to CI servers,\nfor example, Tekton.\n\n### Explanation\n\nAssume have the following config\n```yaml\nrepos:\n  demo:\n    url: https://github.com/username/repo\n    paths:\n      - \"examples/**\"\n```\n\n#### If last file changes matches the pattern\n\n```\n$ git --no-pager diff --name-only HEAD^\nexamples/main.go\n```\n\nIt will return the following response, with `continue` set to `true`\n\n```json\n{\n  \"extensions\": {\n    \"paths\": \"MATCH\"\n  },\n  \"continue\": true,\n  \"status\": {}\n}\n```\n\n#### If last file changes not matches\n\n```\n$ git --no-pager diff --name-only HEAD^\nutil/util.go\n```\n\nIt will return the following response, with `continue` set to `false`\n\n```json\n{\n  \"extensions\": {\n    \"paths\": \"NOT_MATCH\"\n  },\n  \"continue\": false,\n  \"status\": {}\n}\n```\n\n### Installation\n\n#### Environment variables\n\n- `PORT` port (:8080)\n- `CONFIG_FILE` config file location\n- `APP_ENV` app env (dev or prod)\n- `SECRET_TOKEN` (optional) secret token for webhook\n\n#### Interceptor Params\n\n```yaml\n- ref:\n    name: path-change-interceptor\n    kind: ClusterInterceptor\n    params:\n      - name: repo\n        value: demo2 # this will map the values in config.yaml\n```\n\n#### Config\n\nConfig can be updated at [examples/02_config.yaml](examples/02_config.yaml)\n\nCan set config file location with `CONFIG_FILE` env\n\n```yaml\n containers:\n   - name: path-change\n     ...\n     env:\n       - name: CONFIG_FILE\n         value: /etc/fc/config.yaml\n\n```\n\n#### Setting `ref` to be read\n\nMost of the webhook has `ref` on the request body, for example\n\n- [github](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push)\n- [gitlab](https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#push-events)\n- [gitea](https://docs.gitea.io/en-us/webhooks/#event-information)\n- [gitee](https://gitee.com/help/articles/4186#article-header1)\n\n`ref` will be retrieved from `req.body`\n\n\n#### Git credentials\n\nThe examples show git authentication with ssh, please check [examples/02_secret.yaml](examples/02_secret.yaml) to\nreplace the actual value.\n\nIt works with any git credentials, for examples ssh\nor [git-credential-store](https://git-scm.com/docs/git-credential-store). Just mount the related files to home directory\nvolume\n\n##### webhook secret\n\nif you have set webhook secret, please update the secret at [examples/02_secret.yaml](examples/02_secret.yaml)\n\n\u003e set the secret env at [examples/01_deployment](examples/01_deployment.yaml)\n\n```yaml\n containers:\n   - name: path-change\n     ...\n     env:\n       - name: SECRET_TOKEN\n         valueFrom:\n           secretKeyRef:\n             name: webhook-secret\n             key: token\n```\n\n#### Apply the examples\n\n\u003e Make sure you have already installed Tekton Pipelines, Trigger and dashboard\n\n```bash\nkubectl apply -f examples\ntkn hub install task git-clone -n tekton\n```\n\n##### Testing webhook\n\n\u003e For more permanent deployment, consider to use an Ingress to expose it as public url\n\n```bash\nkubectl port-forward -n tekton service/el-simple-listener 8080\n```\n\nRun a tunnel to test webhook, add the generated URL to webhook\n\n```\nngrok http 8080\n```\n\nMake some commits on, the tunnel will received status `202`, it should trigger the pipeline, can view it from the dashbaord\n\n#### Testing locally\n\n```\n curl localhost:8080 -d '{\"ref\": \"refs/heads/main\", \"repository\": {\"ssh_url\": \"git@github.com:WLun001/path-change.gitt\"}}' -H 'Content-Type: application/json' -v\n```\n\nOutput\n\n```\n*   Trying 127.0.0.1:8080...\n* TCP_NODELAY set\n* Connected to localhost (127.0.0.1) port 8080 (#0)\n\u003e POST / HTTP/1.1\n\u003e Host: localhost:8080\n\u003e User-Agent: curl/7.68.0\n\u003e Accept: */*\n\u003e Content-Type: application/json\n\u003e Content-Length: 93\n\u003e\n* upload completely sent off: 93 out of 93 bytes\n* Mark bundle as not supporting multiuse\n\u003c HTTP/1.1 202 Accepted\n\u003c Content-Type: application/json\n\u003c Content-Length: 164\n\u003c\n{\"eventListener\":\"simple-listener\",\"namespace\":\"tekton\",\"eventListenerUID\":\"685ffd5e-2a63-46ef-9405-f325e9f1ba94\",\"eventID\":\"9a6a4530-9aef-4551-ab89-aaaa1c4eae07\"}\n* Connection #0 to host localhost left intact\n```\nit should trigger the pipeline, can view it from the dashbaord\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwlun001%2Fpath-change","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwlun001%2Fpath-change","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwlun001%2Fpath-change/lists"}