Skip to content

Commit

Permalink
Source from the correct branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Hubert-Heijkers committed May 9, 2024
1 parent d32a53f commit 64fc04d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/model_validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
12 changes: 8 additions & 4 deletions .scripts/validate_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]"
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 64fc04d

Please sign in to comment.