Cotton is a serverless GitHub app which upgrades dependencies in projects which use Yarn. It is written in Node.js with the Serverless framework.
Cotton is deployed on AWS using the Serverless framework. It is comprised of 3 lambdas written as Serverless handlers. They invoke each other using the Amazon Simple Notification Service (SNS), and can also be invoked through their REST API endpoints.
upgradeAllInstallations
: upgrades all repos that Cotton is installed on by invoking upgradeInstallation
for each installation. It can be invoked by the REST API endpoint /upgradeAllInstallations
upgradeInstallation
: upgrades all repos in an installation by invoking upgradeRepository
for each repo in the input installation. It can be invoked by the REST API endpoint /upgradeInstallation/{installationID}
, or through an SNS message on the upgradeInstallation
topic.upgradeRepository
: upgrades a repository. It can be invoked by the REST API endpoint /upgradeRepository/{installationID}/{repoOwner}/{repoName}
, e.g. /upgradeRepository/123456/taneliang/Cotton
, or through an SNS message on the upgradeRepository
topic.cp .env.example .env
at the repo root.AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
, following https://serverless.com/framework/docs/providers/aws/guide/credentials/.AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
in .env
.GITHUB_WEBHOOK_SECRET
in .env
.GITHUB_APP_ID
in .env
.yarn deploy
.Run yarn start
. This starts a serverless-offline
server, which simulates API Gateway locally. Note that the upgradeAllInstallations
and upgradeInstallation
handlers will fail to trigger their downstream lambdas as serverless-offline
does not mock SNS.
Run yarn test
. Tests are written with Jest.
Run yarn deploy
. This command uses serverless to deploy Cotton to AWS.