From 64fc04d0dd25a880156fb406fbd5d74a6ed899a9 Mon Sep 17 00:00:00 2001 From: Hubert Heijkers Date: Thu, 9 May 2024 13:53:27 +0200 Subject: [PATCH] Source from the correct branch --- .github/workflows/model_validation.yml | 2 +- .scripts/validate_model.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/model_validation.yml b/.github/workflows/model_validation.yml index 8d611a8..f3d2212 100644 --- a/.github/workflows/model_validation.yml +++ b/.github/workflows/model_validation.yml @@ -24,4 +24,4 @@ jobs: pip install requests - name: Run Model validation script - run: python ./.scripts/validate_model.py ${{ github.event.number }} ${{ github.sha }} + run: python ./.scripts/validate_model.py ${{ github.head_ref }} ${{ github.event.number }} ${{ github.sha }} diff --git a/.scripts/validate_model.py b/.scripts/validate_model.py index 3359abc..198b616 100644 --- a/.scripts/validate_model.py +++ b/.scripts/validate_model.py @@ -2,15 +2,19 @@ from common import * tm1_database_name = "MiniSData" +branch_name = "main" if len(sys.argv) > 1: - pr_number = sys.argv[1] + branch_name = sys.argv[1] +if len(sys.argv) > 2: + pr_number = sys.argv[2] print(f"Pull Request: #{pr_number}") tm1_database_name = f"{tm1_database_name}-{pr_number}" -if len(sys.argv) > 2: - commit_hash = sys.argv[2] +if len(sys.argv) > 3: + commit_hash = sys.argv[3] print(f"Commit Hash: {commit_hash}") tm1_database_name = f"{tm1_database_name}-{commit_hash[:7]}" print(f"Datbase name: {tm1_database_name}") +print(f"Sourcing from branch: {branch_name}") tm1_service_root_url = "http://cwc-tm1-v12-demo.tm1-code.io:4444/tm1/api/v1" tm1_service_username = "hubert@tm1-code.io" @@ -54,7 +58,7 @@ def cleanup(): # Pull the latest version of the sources from the main branch git_pull_payload = { - "Branch": "main" + "Branch": f"{branch_name}" } status_code, response = send_post_request(session, tm1_service_root_url, f"{database_endpoint}/GitPull", git_pull_payload) if status_code != 201: