Kiln
Pages

CI and reviews

With AdonisJS, each pull request can get two checks on AWS CodeBuild: CI runs lint, types and tests, and the Flow review posts each finding on its line. This guide sets them up. Do it once for each AWS account and GitHub account. You will:

  • Connect AWS to GitHub
  • Create a GitHub App that posts the review
  • Store two secrets in AWS

Run the commands from the kiln folder. They use the region ap-south-1. af-south-1 has no AWS CodeConnections, so it does not work.

  1. #Connect AWS to GitHub

    aws cloudformation deploy --region ap-south-1 \
      --stack-name factory-kit-connection \
      --template-file aws/connection.yaml \
      --parameter-overrides ConnectionName=factory-kit-github

    The connection starts as pending. Open Developer Tools → Settings → Connections in the AWS console, and choose Update pending connection. Install the AWS Connector on your GitHub account, with All repositories. A connection works with one GitHub account.

  2. #Create the review app

    Open New GitHub App. Clear Active under Webhook, because AWS starts the review. Give it Pull requests read and write, and Contents read-only. Install it only on this account, with All repositories, and write down the App ID.

  3. #Store the private key

    Generate a private key in the settings of the app. Store it, then delete the file.

    aws ssm put-parameter --region ap-south-1 --name /factory-kit/github-app-key \
      --type SecureString --value file://path/to/key.pem
  4. #Store the Claude token

    Run these in your own terminal, not in a coding agent. The first command prints a token. The second waits for you to paste it, and shows nothing.

    claude setup-token
    read -rs T && aws ssm put-parameter --region ap-south-1 --name /factory-kit/claude-token --type SecureString --value "$T" && unset T
  5. #Fill in the config

    Write these values in aws/config.env of the kiln folder: the region, the name of the connection, the App ID, and the installation number of each app. The number is at the end of the URL of its settings page.

#Connect a repository

After this setup, kiln new connects each new AdonisJS repository by itself. Pass --no-connect to skip it.

With All repositories, both apps can see each repository of the account. A build still exists only for a repository that you connect. To limit the apps, use Only select repositories, and add each new repository to both apps. kiln new then prints a warning with the two links.

When AWS or an app stops the connection, the product still gets created, and kiln new prints the command to run. Connect a repository by hand with:

kiln connect acme-org/acme

For a monorepo, give the folder of the AdonisJS app. The command is safe to run again.

kiln connect acme-org/acme --app-path apps/backend

For a repository of another GitHub account, deploy a second connection with its own ConnectionName, approve it in the console, and pass --connection.

How the checks run gives what each build does.