From 7b8f1e49d87965a645812919c412a0a6268cc7eb Mon Sep 17 00:00:00 2001 From: mseiler <mathieu.seiler@amadeus.com> Date: Wed, 5 Jun 2024 10:51:24 +0200 Subject: [PATCH] fix: missing action parameters --- action.yml | 13 ++++++++++++- ted.py | 17 +++++++++-------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/action.yml b/action.yml index 5abe845..391f8d0 100644 --- a/action.yml +++ b/action.yml @@ -14,6 +14,13 @@ inputs: description: 'TED Flavor' required: true default: 'unit-tests' # can be 'unit-tests', 'python2-3-migration' + github-repository: # flavor of TED to use + description: 'Github repository (ower/repo) to work on' + required: true + push: + description: 'Enable git push and PR creation' + required: false + default: 'true' runs: using: 'docker' image: 'Dockerfile' @@ -23,4 +30,8 @@ runs: - -b - ${{ inputs.git-branch }} - -f - - ${{ inputs.ted-flavor }} \ No newline at end of file + - ${{ inputs.ted-flavor }} + - -ghr + - ${{ inputs.github-repository }} + - -p + - ${{ inputs.push }} \ No newline at end of file diff --git a/ted.py b/ted.py index 97573c2..1a98104 100644 --- a/ted.py +++ b/ted.py @@ -20,8 +20,9 @@ def main(): arguments = parse_arguments() git_url = arguments.git_repo - github_token = arguments.github_token - branch = arguments.branch + github_token = os.getenv('GITHUB_TOKEN') + branch = arguments.git_branch + push = arguments.push github_repository = arguments.github_repository ted_flavor = arguments.ted_flavor @@ -102,7 +103,7 @@ def main(): print("Run generation") generator.run_generation(retriever, llm, output_parser, clone_path) - if(github_repository and branch and github_token): + if(push and github_repository and branch and github_token): GitHelper().push_changes_in_pull_request(github_repository, "ted: suggestions", "feat/ted_suggestions", branch, github_token) def filter_files(file_path, extensions): @@ -127,18 +128,18 @@ def parse_arguments(): optional_args = parser.add_argument_group('optional arguments') - required_args.add_argument('-r', '--git-repo', type=str, help='The Git repo URL', + required_args.add_argument('-r', '--git_repo', type=str, help='The Git repo URL', required=False) - optional_args.add_argument('-b', '--branch', type=str, help='Optional, The branch to use as base', - required=False) - - optional_args.add_argument('-gh', '--github_token', type=str, help='Optional, Github token to create branch and open a pull request', + optional_args.add_argument('-b', '--git_branch', type=str, help='Optional, The branch to use as base', required=False) optional_args.add_argument('-ghr', '--github_repository', type=str, help='Optional, Github repository (owner/repo)', required=False) + optional_args.add_argument('-p', '--push', type=str, help='Optional, Github repository (owner/repo)', + required=False) + return parser.parse_args()