https://github.com/lawvs/gitlab-event-types
TypeScript definitions for GitLab Webhook Event.
https://github.com/lawvs/gitlab-event-types
definitions gitlab types typescript webhook
Last synced: 9 months ago
JSON representation
TypeScript definitions for GitLab Webhook Event.
- Host: GitHub
- URL: https://github.com/lawvs/gitlab-event-types
- Owner: lawvs
- License: mit
- Created: 2022-03-26T15:30:16.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-08-21T19:10:51.000Z (10 months ago)
- Last Synced: 2025-08-21T19:45:55.001Z (10 months ago)
- Topics: definitions, gitlab, types, typescript, webhook
- Language: TypeScript
- Homepage:
- Size: 51.8 KB
- Stars: 3
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GitLab Event Types
[](https://github.com/lawvs/gitlab-event-types/actions/workflows/build.yml)
[](https://www.npmjs.com/package/gitlab-event-types)
TypeScript definitions for [GitLab Webhook Event](https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html).
## Install
```sh
# Use npm
npm install -D gitlab-event-types
# Use yarn
yarn add -D gitlab-event-types
# Use pnpm
pnpm add -D gitlab-event-types
```
## Usages
```ts
import type { WebhookEvents, PushEvent } from "gitlab-event-types";
const isPushEvent = (event: WebhookEvents): event is PushEvent =>
"object_kind" in event && event.object_kind === "push";
const hookHandler = async (event: WebhookEvents) => {
if (isPushEvent(event)) {
console.log(event.commits);
}
};
```
Or
```ts
import type * as GitlabEventTypes from "gitlab-event-types";
const pushEventHandler = async (event: GitlabEventTypes.PushEvent) => {
console.log(event.object_kind);
};
```
## Definitions
```ts
export type WebhookEvents =
| PushEvent
| TagPushEvent
| IssueEvent
| CommentEvent
| MergeRequestEvent
| WikiPageEvent
| PipelineEvent
| JobEvent
| DeploymentEvent
| GroupMemberEvent
| ProjectEvent
| SubgroupEvent
| FeatureFlagEvent
| ReleaseEvent
| MilestoneEvent
| EmojiEvent
| AccessTokenEvent
| VulnerabilityEvent;
```
## Credits
Thanks to [excaliburhan/node-gitlab-webhook](https://github.com/excaliburhan/node-gitlab-webhook)(MIT License).
## License
MIT