Buff your Github contributor graph with daily commits to a repository of your choosing.
Easily run on a schedule of your choosing using AWS Lamba and a CloudWatch scheduled event as a trigger. Upload release zip as code to your Lambda function.
Required environment variables
REPO_URL # URL to the repository. Public or private
GITHUB_TOKEN # API Token
REPO_NAME # Name of repository
COMMIT_FILE # Name of file to write to
AUTHOR_NAME # Your name
AUTHOR_EMAIL # Your email address
You can setup Github-Buff in two ways
Get the AWS CLI and configure it using aws configure
Download the release code zip file and run the following command to create an AWS Lambda function
aws lambda create-function \
--region us-west-2 \
--function-name github-buff \
--zip-file fileb:GITHUB_BUFF_ZIP_PATH \
--role ARN_ROLE \
--handler bundle.handler \
--runtime nodejs6.10 \
--profile adminuser \
--timeout 15
In order to create the daily schedule, run the following commands
aws events put-rule \
--name github-buff-schedule \
--schedule-expression 'rate(1 day)'
This will give you a repsonse similar to
{
"version": "0",
...
"resources": [
"arn:aws:events:us-east-1:123456789012:rule/my-scheduled-rule"
]
}
Use the resources ARN ID from the reponse in the following command
aws lambda add-permission \
--function-name github-buff \
--statement-id my-scheduled-event \
--action 'lambda:InvokeFunction' \
--principal events.amazonaws.com \
--source-arn arn:aws:events:us-east-1:123456789012:rule/my-scheduled-rule
Finally, add the rule to your Lambda function
aws events put-targets --rule github-buff-schedule --targets "Id"="<theID>","Arn"="<theLambdaARN>"
Start by creating a Lambda Function using the AWS Lambda console
Click the Create Function button and edit the function to have the following properties
Once created, go into the function and change the Code Entry Type to Upload a .Zip File
and upload the release zip of Github-buff as your code
The next step is to save the environment variables for use by the script. Place your own information here
Setting up Git and cloning the repository can take time during execution. I recommend setting a 15 second timeout
Finally, create a scheduled trigger for the Lambda function. Choose a CloudWatch Event trigger
Configure the CloudWatch trigger to run on a daily schedule by setting the rate to rate(1 day)
Once this is completed, save the Lambda function.
You're all set! You will now get daily commits to the repository of your choosing.