https://github.com/padupe/lambda-create-repository-python
Lambda for repositories creation at GitHub.
https://github.com/padupe/lambda-create-repository-python
lambda python3 serverless
Last synced: 8 months ago
JSON representation
Lambda for repositories creation at GitHub.
- Host: GitHub
- URL: https://github.com/padupe/lambda-create-repository-python
- Owner: padupe
- Created: 2022-05-24T23:58:23.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-15T11:50:22.000Z (almost 4 years ago)
- Last Synced: 2025-07-14T09:24:38.174Z (9 months ago)
- Topics: lambda, python3, serverless
- Language: Python
- Homepage:
- Size: 415 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README




# lambda-create-repository-python
> Check the Documentation in pt-BR by clicking 🇧🇷 [here](https://github.com/padupe/lambda-create-repository-python/blob/main/docs/README-pt-BR.md 'here').
[![Technology][python-image]][python-url]
[![Technology][aws-lambda-image]][aws-lambda-url]



[python-url]: https://www.python.org/
[python-image]: https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54
[aws-lambda-url]: https://aws.amazon.com/pt/lambda/
[aws-lambda-image]: https://img.shields.io/badge/aws.lambda-yellow?style=for-the-badge&logo=amazon&logoColor=black
## Index
* [lambda-create-repository-python](#lambda-create-repository-python)
* [Index](#index)
* [Description](#description)
* [Flow](#flow)
* [Business Context](#bussiness-context)
* [Project Dependencies](#project-dependencies)
* [Payload](#payload)
* [Payload Structure](#payload-structure)
* [Payload Example (Complete)](#payload-example-complete)
* [Payload Example (Simple)](#payload-example-simple)
* [Status Code](#status-code)
* [Local Development](#local-development)
* [Requirements](#requirements)
* [Step by Step](#step-by-step)
## Description
Creates a Repository on GitHub, using the service's API.
In addition, it adds the `"deploys"` and `"{Owner-Squad}-ADMIN"` teams of the Project Owner Squad and performs the dynamic creation of the `README.md`.
## Flow

## Bussiness Context
Allow a dynamic management in the organization's repository creation process.
Team Tech <-> **Team responsible for managing GitHub in the Organization** <-> GitHub
## Project Dependencies
- [mdutils](https://pypi.org/project/mdutils/ 'mdutils'): This Python package contains a set of basic tools that can help to create a markdown file while running a Python code;
- [requests](https://pypi.org/project/requests/ 'requests'): Requests is a simple HTTP library.
## Payload
### Payload Structure
|Parameter|Value|Required|
|:---:|:---:|:---:|
|`repository_title`|`string`|`true`|
|`team_owner`|`string`|`true`|
|`private`|`boolean`|`true`|
|`about`|`string`|`true`|
|`description`|`string`|`true`|
|`business_context`|`string`|`true`|
|`requirements`|`array`|`true`|
|`integration`|`array`|`true`|
### Payload Example (Complete)
```json
{
"repository_title": "Repository-Test",
"team_owner": "lambda-test",
"private": true,
"about": "Repository create with Lambda",
"description": "An repository test.",
"business_context": "Repository test with Lambda",
"requirements": [
"Nodejs",
"Docker"
],
"integration": [
"Life-Cycle",
"Order-Service"
]
}
```
> NOTE: The "private" parameter can be passed as an empty string, as by default this property is "true".
### Payload Example (Simple)
```json
{
"repository_title": "Repository-Test-Two",
"team_owner": "lambda-test",
"private": "",
"about": "Repository create with Lambda",
"description": "An repository test.",
"business_context": "Repository test with Lambda",
"requirements": [],
"integration": []
}
```
> NOTE: The "private" parameter can be passed as an empty string, as by default this property is "true".
## Status Code
- **201**
- Repository Created
- **404**
- Failure to find team `{team_owner}` at `{ORGANIZATION}`
- Repository `{repository_title}` already exists at `{ORGANIZATION}`
- **500**
- Error while running lambda: `{err}`
## Local Development
### Requirements:
- CLI [Serverless](https://www.serverless.com/framework/docs/getting-started);
- Pip3;
- Python 3.8 =<.
### Step by Step
1. Rename `serverless.yaml` to `serverles-prd.yaml`;
2. Rename `serverless-local.yaml` to `serverless.yaml`;
3. In the `configs` directory, in the [`constants.py`](https://github.com/padupe/lambda-create-repository-python/blob/main/configs/constants.py) file, enter a Personal Access Token (PAT) with Organization "Owner" privileges (permission to create repositories, link teams, etc.) in the `PAT_USER` constant;
4. In the `configs` directory, in the [`constants.py`](https://github.com/padupe/lambda-create-repository-python/blob/main/configs/constants.py) file, enter the name of the organization you belong to in the `ORGANIZATION` constant;
4.1 If your organization does not have auxiliary teams (`"{Owner-Squad}-ADMIN"`, `"deploys"`, etc), comment out (or remove) lines 21 and 22 of the [`app.py`](https://github.com/padupe/lambda-create-repository-python/blob/main/app/app.py) file.
5. Run:
```
serverless invoke local --function create-repository --path example.json
```
**NOTE:**
A repository will be created with the name **`repository-test`** in your organization.