Skip to content

wallabag/serverless-bot

Repository files navigation

wallabag Serverless Bot

serverless Tests

This serverless project does some stuff to help the wallabag team. It:

  • validates PRs sent to site-config repository: fivefilters & graby
  • automatically label PRs created by Weblate
  • more to come!

image

Use Cases

Available lambdas:

  • extension: It validates each file in the diff has a .txt extension.
  • weblate: It automatically label PRs created by Weblate.

Prerequisites

  • Node.js 20
  • Serverless CLI v3.37.0 or later (npm install -g serverless@3)
  • An AWS account
  • Defined provider credentials

Setup

Deploy the code

By default

  • it'll use the AWS profile default, but you can use your own using (be sure it's defined in your ~/.aws/credentials): serverless deploy --aws-profile myprofile
  • it'll be deployed to the AWS region eu-west-1 but you can change it using: serverless deploy --region us-east-1

Setup GitHub webhook

Configure the webhook in the GitHub repository settings.

  • In the Payload URL, enter the URL you received after deploying. It would be something like https://<your_url>.amazonaws.com/dev/webhook/....
  • Choose the "application/json" in Content type.
  • In the types of events to trigger the webhook, select "Let me select individual events", then select at least Pull Requests.

Some options

You can update some options from the serverless.yml file:

  • NAMESPACE: change the namespace used in the PR check (displayed at the bottom of each PR)

Info

Inspired from 20minutes/serverless-github-check.