From efd3581a3faf9ac8e407ffba3fea098b5b651294 Mon Sep 17 00:00:00 2001 From: alalkamys Date: Thu, 16 May 2024 09:46:11 +0300 Subject: [PATCH 1/2] feat: Actor Identity Config is Now Dynamic --- README.md | 24 +++++++++++++----------- app/config.py | 6 +++--- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 09251e0..46a7449 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ With `Code Migration Assistant` teams can accelerate the migration of code repos ## Table of contents + - [Code Migration Assistant](#code-migration-assistant) - [Table of contents](#table-of-contents) - [Key Features](#key-features) @@ -34,7 +35,6 @@ With `Code Migration Assistant` teams can accelerate the migration of code repos - [Environment Variables](#environment-variables) - [⚔️ Developed By](#️-developed-by) - [:book: Author](#book-author) - ## Key Features @@ -286,16 +286,18 @@ Below is an explanation of each field in the configuration file: ## Environment Variables -| Environment Variable | Usage | Default Value | -| ------------------------------------------------------ | ------------------------------------------------------------------------- | ------------------------------------ | -| `CODE_MIGRATION_ASSISTANT_APP_NAME` | Name of the Code Migration Assistant application | `code_migration_assistant` | -| `CODE_MIGRATION_ASSISTANT_LOG_LEVEL` | Log level for the Code Migration Assistant application | `INFO` | -| `CODE_MIGRATION_ASSISTANT_TARGETS_CONFIG_FILE` | Path to the targets configuration file for Code Migration Assistant | `./config.json` | -| `CODE_MIGRATION_ASSISTANT_REMOTE_TARGETS_CLONING_PATH` | Path where remote repositories will be cloned by Code Migration Assistant | `./remote-targets` | -| `AZURE_DEVOPS_PAT` | Azure DevOps Personal Access Token (PAT) | `None` | -| `GITHUB_TOKEN` | GitHub Personal Access Token (PAT) | `None` | -| `GITHUB_ENTERPRISE_TOKEN` | GitHub Enterprise Personal Access Token (PAT) | `None` | -| `CODE_MIGRATION_ASSISTANT_USER_AGENT` | User agent used for HTTP requests by Code Migration Assistant | `alalkamys/code-migration-assistant` | +| Environment Variable | Usage | Default Value | +| ------------------------------------------------------ | ------------------------------------------------------------------------- | ------------------------------------------ | +| `CODE_MIGRATION_ASSISTANT_APP_NAME` | Name of the Code Migration Assistant application | `code_migration_assistant` | +| `CODE_MIGRATION_ASSISTANT_LOG_LEVEL` | Log level for the Code Migration Assistant application | `INFO` | +| `CODE_MIGRATION_ASSISTANT_TARGETS_CONFIG_FILE` | Path to the targets configuration file for Code Migration Assistant | `./config.json` | +| `CODE_MIGRATION_ASSISTANT_REMOTE_TARGETS_CLONING_PATH` | Path where remote repositories will be cloned by Code Migration Assistant | `./remote-targets` | +| `AZURE_DEVOPS_PAT` | Azure DevOps Personal Access Token (PAT) | `None` | +| `GITHUB_TOKEN` | GitHub Personal Access Token (PAT) | `None` | +| `GITHUB_ENTERPRISE_TOKEN` | GitHub Enterprise Personal Access Token (PAT) | `None` | +| `CODE_MIGRATION_ASSISTANT_USER_AGENT` | User agent used for HTTP requests by Code Migration Assistant | `alalkamys/code-migration-assistant` | +| `CODE_MIGRATION_ASSISTANT_ACTOR_USERNAME` | Actor username used for git identity setup | `Code Migration Assistant Agent` | +| `CODE_MIGRATION_ASSISTANT_ACTOR_EMAIL` | Actor email used for git identity setup | `code_migration_assistant_agent@gmail.com` |
diff --git a/app/config.py b/app/config.py index 4d2eb65..26ed338 100644 --- a/app/config.py +++ b/app/config.py @@ -21,7 +21,7 @@ class AppConfig: AZURE_DEVOPS_PAT (str): The Personal Access Token (PAT) for Azure DevOps. Defaults to None. GITHUB_TOKEN (str): The Personal Access Token (PAT) for GitHub. Defaults to None. GITHUB_ENTERPRISE_TOKEN (str): The Personal Access Token (PAT) for GitHub Enterprise. Defaults to None. - ACTOR (dict): A dictionary containing the username and email of the application's agent. + ACTOR (dict): A dictionary containing the username and email of the application's agent. Defaults to {'username': "Code Migration Assistant Agent", 'email': "code_migration_assistant_agent@gmail.com"} USER_AGENT (str): The user agent for making HTTP requests. Defaults to "alalkamys/code-migration-assistant". LOGGING_CONFIG (dict): Configuration settings for logging. """ @@ -66,8 +66,8 @@ class AppConfig: GITHUB_ENTERPRISE_TOKEN = os.getenv('GITHUB_ENTERPRISE_TOKEN', None) ACTOR = { - 'username': "Code Migration Assistant Agent", - 'email': 'code_migration_assistant_agent@gmail.com' + 'username': os.getenv('CODE_MIGRATION_ASSISTANT_ACTOR_USERNAME', "Code Migration Assistant Agent"), + 'email': os.getenv('CODE_MIGRATION_ASSISTANT_ACTOR_EMAIL', "code_migration_assistant_agent@gmail.com") } USER_AGENT = os.getenv( From 41f1fb75b32c6a1778293c3519e110627e34d75e Mon Sep 17 00:00:00 2001 From: alalkamys Date: Thu, 16 May 2024 10:20:31 +0300 Subject: [PATCH 2/2] docs: update `targetBranch` description --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 46a7449..0e6fc40 100644 --- a/README.md +++ b/README.md @@ -216,7 +216,7 @@ Below is an explanation of each field in the configuration file: ### `targetBranch` (Optional) -- **Description**: Specifies the target branch for the pull request. +- **Description**: Specifies the target branch on which the replacements will occur and will be the source branch for your pull requests. - **Fields**: - `name` (required): Name of the target branch. - `from` (Optional): Source branch from which the target branch is created.