Skip to content
This repository has been archived by the owner on Jun 14, 2021. It is now read-only.

A GitLab webhook listener to add achievements to interactions

Notifications You must be signed in to change notification settings

AlexGustafsson/achievements

Repository files navigation

Achievements

A GitLab webhook listener to add achievements to interactions


Quick Start

Running using Docker

# Build the Docker image
./build.sh

# Run the Docker image
docker run -it axgn/achievements

Running from source

# Clone the repository
git clone git@github.com/AlexGustafsson/achievements

# Enter the repository and install the dependencies
cd achievements
npm install

# Start the project
npm start

Documentation

Running

# Run in production mode
npm start

# Run in development mode
npm run dev

The port can be controlled using the environment variable PORT. To configure the server to verify GitLab webhooks, use the environment variable GITLAB_ENVIRONMENT. The directory used for data storage can be configured using the DATA_DIRECTORY environment variable.

The application should run behind a reverse proxy as it does not handle TLS, load balancing, rate limiting or other imortant techniques.

Configuration

Currently configuration is done via environment variables. These can be found in the section above.

API

The API is currently undocumented. Please see the src/index.js file for current routes.

Achievements

The list of achievements is currently undocumented. Please see the src/achievements.json file for current achievements. This file is merely the available achievements, not how achievements are implemented.

Implementing an achievement

The application exposes GitLab's webhooks as hooks available within the hooks directory. Each file corresponds to an event type available via GitLab's webhooks.

Each exported function in a hook file will be executed when an event is received from GitLab. Currently the documentation of the API is sparse, but there are some implementations from which one should be able to interpolate an implementation.

Contributing

Guidelines

# Clone the repository
git clone git@github.com/AlexGustafsson/achievements

# Install dependencies
npm install

# Write code and commit it

# Follow the conventions enforced
npm run lint-javascript
npm run lint-shell
npm run lint-docker
npm run test
npm run coverage
npm run check-duplicate-code

# Run the project for manual testing
npm run dev

Dependencies

This project targets NodeJS 13.

Development dependencies

The following dependencies need to be manually installed.

  • ShellCheck
    • brew install shellcheck
    • apt install shellcheck
  • hadolint
    • brew install hadolint