{"id":15055523,"url":"https://github.com/dgroup/g2w","last_synced_at":"2025-04-10T03:52:41.337Z","repository":{"id":38067499,"uuid":"442136506","full_name":"dgroup/g2w","owner":"dgroup","description":"Gateway to notify Worksection tasks about events from Grafana, Gitlab (e.g commits)","archived":false,"fork":false,"pushed_at":"2023-04-21T12:58:33.000Z","size":123,"stargazers_count":5,"open_issues_count":28,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T03:52:32.254Z","etag":null,"topics":["gitlab","grafana","grafana-alert","grafana-alerts","integration","worksection"],"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/dgroup.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["dgroup"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2021-12-27T11:10:31.000Z","updated_at":"2022-01-21T21:01:21.000Z","dependencies_parsed_at":"2023-02-16T18:50:36.398Z","dependency_job_id":null,"html_url":"https://github.com/dgroup/g2w","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":"rochacbruno/python-project-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgroup%2Fg2w","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgroup%2Fg2w/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgroup%2Fg2w/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgroup%2Fg2w/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dgroup","download_url":"https://codeload.github.com/dgroup/g2w/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154998,"owners_count":21056542,"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":["gitlab","grafana","grafana-alert","grafana-alerts","integration","worksection"],"created_at":"2024-09-24T21:43:42.333Z","updated_at":"2025-04-10T03:52:41.309Z","avatar_url":"https://github.com/dgroup.png","language":"Python","funding_links":["https://github.com/sponsors/dgroup"],"categories":[],"sub_categories":[],"readme":"[![License: MIT](https://img.shields.io/github/license/mashape/apistatus.svg)](./license.txt)\n[![Versions](https://img.shields.io/badge/semver-2.0-green)](https://semver.org/spec/v2.0.0.html)\n[![PyPI version](https://badge.fury.io/py/g2w.svg)](https://badge.fury.io/py/g2w)\n[![Downloads](https://pepy.tech/badge/g2w)](https://pepy.tech/project/g2w)\n[![](https://img.shields.io/docker/pulls/dgroup/g2w.svg)](https://hub.docker.com/r/dgroup/g2w \"Image pulls\")\n[![](https://images.microbadger.com/badges/image/dgroup/g2w.svg)](https://microbadger.com/images/dgroup/g2w \"Image layers\")\n[![Commit activity](https://img.shields.io/github/commit-activity/y/dgroup/g2w.svg?style=flat-square)](https://github.com/dgroup/g2w/graphs/commit-activity)\n[![Hits-of-Code](https://hitsofcode.com/github/dgroup/g2w?branch=master)](https://hitsofcode.com/view/github/dgroup/g2w?branch=master)\n\n[![CI](https://github.com/dgroup/g2w/actions/workflows/master.yml/badge.svg)](https://github.com/dgroup/g2w/actions/workflows/master.yml)\n[![0pdd](http://www.0pdd.com/svg?name=dgroup/g2w)](http://www.0pdd.com/p?name=dgroup/g2w)\n[![Dependency Status](https://requires.io/github/dgroup/g2w/requirements.svg?branch=master)](https://requires.io/github/dgroup/g2w/requirements/?branch=master)\n[![Known Vulnerabilities](https://snyk.io/test/github/dgroup/g2w/badge.svg)](https://app.snyk.io/org/dgroup/project/97a5d0de-3c9f-40ef-8ed6-42370d7a3330)\n\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=dgroup_g2w\\\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=dgroup_g2w)\n[![Codebeat badge](https://codebeat.co/badges/6399823c-f81c-4de7-b8d7-3fb6990d2b36)](https://codebeat.co/projects/github-com-dgroup-g2w-master)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/7d93a4c0de9c40e5bae9633cd6fbc201)](https://www.codacy.com/gh/dgroup/g2w/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=dgroup/g2w\u0026amp;utm_campaign=Badge_Grade)\n[![Codecov](https://codecov.io/gh/dgroup/g2w/branch/master/graph/badge.svg?token=PSTG3JNRX6)](https://codecov.io/gh/dgroup/g2w)\n\n#### What is Worksection?\n[Worksection](https://worksection.com) is a simple, lightweight task tracking system that provides:\n * Project and task management, planning and controlling, team organization\n * Flexible interface, recurring processes, time-tracking\n * Privacy settings, client companies, communication\n\nCheck it out.\n\n#### Worksection task id in Git commit messages\nUse [commit-msg](commit-msg) file to force your developers to have worksection task id during commits.\nJust copy this file to your git repo as\n```bash\ncp commit-msg \u003cyour-git-repo\u003e/.git/hook/commit-msg   # on Git server directly (server-side commit)\n```\nSince this moment all commit messages should have the following format `#WS-0000: The commit message`, where `0000` is worksection task id.\n\n#### Open API docs\nRun it and all endpoints details will be available here: http://localhost:8080/docs\n```bash\n\u003e python g2w\n...                                                                                                                                                \nINFO:     Started server process [86248]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)\n```\n\n#### Push notifications\nPlease note, that `GitLab` commit messages must have the following format: `#WS-0000: The commit message`, where `0000` is worksection task id.\n1. Deploy locally g2w\n    ```yml\n    version: \"3.9\"\n    services:\n      g2ws:\n        image: dgroup/g2w:0.2.0\n        container_name: g2w\n        environment:\n          # Mandatory environment variables (docker, podman, etc.)\n          WS_URL_ALL_USERS: \"https://xxx.worksection.com/xxxx\"    # https://worksection.com/faq/api-user.html#q1572\n          WS_URL_POST_COMMENT: \"https://xxx.worksection.com/xxxx\" # https://worksection.com/faq/api-comments.html#q1575\n          WS_URL_POST_TASK: \"https://xxx.worksection.com/xxxx\"    # https://worksection.com/faq/api-task.html#q1577\n          WS_ADMIN_EMAIL: \"xxx.worksection.bot@gmail.com\"         # plain worksection user email\n          WS_ADMIN_USER_ID: \"370080\"                              # plain worksection user id\n          WS_PRJ_223728_POST_TASK_HASH: \"23e1sdfj2323\"            # HASH generated for new task action for a particular project\n          WS_PRJ_223728_POST_COMMENT_HASH: \"2312jsafajsdf\"        # HASH generated for new comment action for a particular project\n        build:\n          dockerfile: Containerfile\n          context: .\n        ports:\n          - \"8080:8080\"\n        restart: always\n    ```\n2. Configure webhook with `Push events` in Gitlab: \n   1. Open `project \u003e Settings \u003e Webhook` \n   2. Specify URL http://yourserverwith-g2w:8080/gitlab/push/223728, where `223728` is your worksection project id\n   3. Ensure that `Push events` option is selected\n   4. Press [`Add webhook`]\n3. Configure reference to Worksection tasks from commits in Gitlab: \n   1. Open `project \u003e Settings \u003e Integrations \u003e Custom issue tracker`\n   2. Set `Project URL` like https://xxx.worksection.com/project/223728/, where `223728` is your worksection project id\n   3. Set `Issue URL` like https://xxx.worksection.com/project/223728/:id\n   4. Set `New issue URL` like https://xxx.worksection.com/project/223728/new/\n   5. Press [`Save changes`]\n4. Push commit(s) with following commit message format `#WS-0000: The commit message` format (`0000` is worksection task id) to your Gitlab project.\n\n#### Simulate push Gitlab event\n`223728` - worksection project id (read [more](/tests/test_app.py)):\n```bash\ncurl --request POST \\\n  --url http://127.0.0.1:8080/gitlab/push/223728 \\\n  --header 'Content-Type: application/json' \\\n  --data '{\n  \"object_kind\": \"push\",\n  \"event_name\": \"push\",\n  \"before\": \"95790bf891e76fee5e1747ab589903a6a1f80f22\",\n  \"after\": \"da1560886d4f094c3e6c9ef40349f7d38b5d27d7\",\n  \"ref\": \"refs/heads/master\",\n  \"checkout_sha\": \"da1560886d4f094c3e6c9ef40349f7d38b5d27d7\",\n  \"user_id\": 4,\n  \"user_name\": \"John Smith\",\n  \"user_username\": \"jsmith\",\n  \"user_email\": \"john@example.com\",\n  \"user_avatar\": \"https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80\",\n  \"project_id\": 15,\n  \"project\":{\n    \"id\": 15,\n    \"name\":\"Diaspora\",\n    \"description\":\"\",\n    \"web_url\":\"http://example.com/mike/diaspora\",\n    \"avatar_url\":null,\n    \"git_ssh_url\":\"git@example.com:mike/diaspora.git\",\n    \"git_http_url\":\"https://example.com/mike/diaspora.git\",\n    \"namespace\":\"Mike\",\n    \"visibility_level\":0,\n    \"path_with_namespace\":\"mike/diaspora\",\n    \"default_branch\":\"master\",\n    \"homepage\":\"http://example.com/mike/diaspora\",\n    \"url\":\"git@example.com:mike/diaspora.git\",\n    \"ssh_url\":\"git@example.com:mike/diaspora.git\",\n    \"http_url\":\"https://example.com/mike/diaspora.git\"\n  },\n  \"repository\":{\n    \"name\": \"Diaspora\",\n    \"url\": \"git@example.com:mike/diaspora.git\",\n    \"description\": \"\",\n    \"homepage\": \"http://example.com/mike/diaspora\",\n    \"git_http_url\":\"https://example.com/mike/diaspora.git\",\n    \"git_ssh_url\":\"git@example.com:mike/diaspora.git\",\n    \"visibility_level\":0\n  },\n  \"commits\": [\n    {\n      \"id\": \"b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327\",\n      \"message\": \"Update Catalan translation to e38cb41.\\n\\nSee https://gitlab.com/gitlab-org/gitlab for more information\",\n      \"title\": \"Update Catalan translation to e38cb41.\",\n      \"timestamp\": \"2011-12-12T14:27:31+02:00\",\n      \"url\": \"http://example.com/mike/diaspora/commit/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327\",\n      \"author\": {\n        \"name\": \"Jordi Mallach\",\n        \"email\": \"jordi@softcatala.org\"\n      },\n      \"added\": [\"CHANGELOG\"],\n      \"modified\": [\"app/controller/application.rb\"],\n      \"removed\": []\n    },\n    {\n      \"id\": \"da1560886d4f094c3e6c9ef40349f7d38b5d27d7\",\n      \"message\": \"fixed readme\",\n      \"title\": \"fixed readme\",\n      \"timestamp\": \"2012-01-03T23:36:29+02:00\",\n      \"url\": \"http://example.com/mike/diaspora/commit/da1560886d4f094c3e6c9ef40349f7d38b5d27d7\",\n      \"author\": {\n        \"name\": \"GitLab dev user\",\n        \"email\": \"gitlabdev@dv6700.(none)\"\n      },\n      \"added\": [\"CHANGELOG\"],\n      \"modified\": [\"app/controller/application.rb\"],\n      \"removed\": []\n    }\n  ],\n  \"total_commits_count\": 4\n}'\n```\n## Build\n```bash\n# Using *.sh file on Linux, Unix, OSX\n\u003e ./build.sh\n\n# Using make\nmake virtualenv install test\n\n```\n\n## Install it from PyPI\n\n```bash\npip install g2w\n```\n\n## Materials \u0026 Links\n* http://www.md5.cz - generate WS hash\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgroup%2Fg2w","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdgroup%2Fg2w","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgroup%2Fg2w/lists"}