Telemetry-Functions is the middle layer of the DEVEN Telemetry project, which is designed to collect anonymized, automized metrics using Git SaaS based bots to inform about how teams can improve development retention, productivity and satisfaction for more effectiveness. Telemetry-functions serves as the bridge between the Github OAuth App, which allows access to the raw data, and the private data repository, where the collected data is stored.
This project is a Node.js package. You need Node version 18 or higher in order to run it. (for more information check out the Node.js documentation here).
If you don't have NPM installed, please install it first.
-
npm
npm install npm@latest -g
In addition, you'll need to log in to Github in your browser.
-
Clone the repo
git clone https://github.com/deven-org/telemetry-functions.git
-
In the command line, navigate to the project directory.
-
Install NPM packages
npm install
- Open the
env.template
file and copy the list of environment variables and their default values. These include:
- REPO_NAME
- REPO_OWNER
- REPO_PATH
- TARGET_BRANCH
- GITHUB_ACCESS_TOKEN
- COMMITTER_NAME
- COMMITTER_EMAIL
- AUTHOR_NAME
- AUTHOR_EMAIL
- CONFLICT_RETRIES
- Create a new file in the root directory named
.env
and paste the list of environment variables in, exactly as it appears in the env.template file.
- In the command line, start the Netlify function with:
npm run dev:netlify
This way you can test the netlify function and manually send events to the
http://localhost:9999/.netlify/functions/metrics
, e.g. using the provided
Postman collection.
Warning
Since this method reads and writes actual GitHub data, channelled through a third-party service, make sure you don't add the webhook to repositories with sensitive or private data. Also don't allow access to such repos using the configured tokens!
Alternatively, if you set up valid tokens (one for a repo to write into, and one for reading from source repositories), you can test the function as it would run in production by running
npm run dev
This will both start the function as above, and also create a webhook proxy using Smee as recommended by GitHub. That will forward events sent to a newly created, publically reachable, URL to your local function instance. The webhook URL is logged to the terminal, so that you can configure it for the source organisation or repo.
The project test suite is run with
npm test
While developing, it may be more convenient to run tests automatically when project files are updated. This can be run with
npm test:dev
Contributions are welcome! Please see the contribution guidelines for more information.
Telemetry Functions is MIT licensed.