Skip to content

Buff your Github contributor graph with automated daily commits

License

Notifications You must be signed in to change notification settings

chrispouliot/github-buff

Repository files navigation

Github-buff

Buff your Github contributor graph with daily commits to a repository of your choosing.

Usage

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

Using the AWS CLI

Using the AWS Console

Using the AWS CLI

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>"

Using the AWS Console

Start by creating a Lambda Function using the AWS Lambda console

Image of AWS Lambda console

Click the Create Function button and edit the function to have the following properties

Image of AWS Lambda function configuration editor

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

AWS Lambda code editor

The next step is to save the environment variables for use by the script. Place your own information here

AWS Lambda environment variables

Setting up Git and cloning the repository can take time during execution. I recommend setting a 15 second timeout

AWS Lambda timeout configuration

Finally, create a scheduled trigger for the Lambda function. Choose a CloudWatch Event trigger

AWS Lambda trigger selection

Configure the CloudWatch trigger to run on a daily schedule by setting the rate to rate(1 day)

AWS CloudWatch trigger configuration

Once this is completed, save the Lambda function.

You're all set! You will now get daily commits to the repository of your choosing.

About

Buff your Github contributor graph with automated daily commits

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published