Search This Blog

Showing posts with label github. Show all posts
Showing posts with label github. Show all posts

Saturday, August 29, 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

Set up approvals in Github

Resolution

In this section, you set up a rule on GitHub that requires at least one reviewer to approve a pull request before it can be merged into the master branch. You set up the rule and then verify that it works by pushing up a fix to the typing error that Mara made earlier.

Add the rule

  1. In GitHub, go to your XXXXXXXX project repository.
  2. Select the Settings tab near the top of the page.
  3. On the menu, select Branches.
  4. Make sure that master is selected as your default branch.
  5. Select Add rule.
  6. Under Branch name pattern, enter master.
  7. Select the Require pull request reviews before merging check box.
  8. Keep the Required approving reviews value at 1.
  9. To create the rule in the master branch, select Create.
  10. Select Save changes.