Giter VIP home page Giter VIP logo

github-buff's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.