Search This Blog

Saturday 29 August 2020

Lambda function for weekly commit into github --> python code

Resolution

import github

import time

from github import Github

def lambda_handler(event, context):

g = Github(base_url="https://github.com/api/v3", 

login_or_token="*********************************")

repo = g.get_user().get_repo("company-search-weekly-commit-repo")

contents = repo.get_contents("weekly-commit")

repo.update_file(contents.path, "committed file on " + time.asctime(), "committed on " + time.asctime(), contents.sha, branch="master")

return context.aws_request_id

No comments:

Post a Comment