From d3d8156ec3c31eb4969514e5e24c82d8472c6f01 Mon Sep 17 00:00:00 2001 From: iamdez99 Date: Mon, 7 Oct 2024 14:49:03 -0400 Subject: [PATCH] SharePoint testing --- .github/scripts/upload_to_sharepoint.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/scripts/upload_to_sharepoint.py b/.github/scripts/upload_to_sharepoint.py index e99b377ce..55f78d9d2 100644 --- a/.github/scripts/upload_to_sharepoint.py +++ b/.github/scripts/upload_to_sharepoint.py @@ -1,7 +1,7 @@ import requests import json import os -from requests.auth import HTTPBasicAuth +import glob # Azure AD App details client_id = os.environ['client_id'] @@ -41,13 +41,14 @@ def upload_file_to_sharepoint(file_name, file_content): # Get the file content -file_path = os.environ['file_path'] +file_paths = glob.glob('target/html-charms-rasopathy-regression-reports/*') -# Make sure it's a single file, you might want to set up a loop if it's multiple files -with open(file_path, 'rb') as f: - file_content = f.read() +# Iterate over all files in the directory and upload +for file_path in file_paths: + with open(file_path, 'rb') as f: + file_content = f.read() -# Use the filename from file_path for the SharePoint upload -file_name = file_path.split('/')[-1] # gets the file name + # Use the filename from file_path for the SharePoint upload + file_name = file_path.split('/')[-1] # gets the file name -upload_file_to_sharepoint(file_name, file_content) + upload_file_to_sharepoint(file_name, file_content)