forked from ibarrau/PowerBi-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.yml
More file actions
56 lines (45 loc) · 2.04 KB
/
Copy pathmain.yml
File metadata and controls
56 lines (45 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Process Reports and Models
on:
push:
paths:
- 'PowerBi Reports/**' # Trigger only when there's a change in this folder
jobs:
process_changes:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the code
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 3
# Step 2: Set up Python environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
# Step 3: Install the necessary Python package from PyPI
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install simplepbi
# Step 4: Get list of changed folders ending with .report or .semanticmodel
- name: Get changed folders
id: detect_changes
run: |
# Define the folder to check for changes
target_folder="PowerBi Reports/"
# Ensure we're comparing against the previous commit (use HEAD and HEAD^)
# changed_folders=$(git diff --name-only HEAD^..HEAD -- "$target_folder" | grep -E "/.*\.(Report|SemanticModel)/" | cut -d/ -f1-2 | sort | uniq)
changed_folders=$(git diff --name-only HEAD^..HEAD -- "$target_folder" | \
sed 's|/[^/]*$||' | sort | uniq)
# Save changed folders to output for later use
# echo "changed_folders=$changed_folders" >> $GITHUB_ENV
# echo "changed_folders=$changed_folders" | sed 's/ /\\n/g' >> $GITHUB_ENV
changed_folders=$(echo "$changed_folders" | tr '\n' ',')
# Remove trailing comma if it exists
changed_folders="${changed_folders%,}"
echo "changed_folders=$changed_folders" >> $GITHUB_ENV
echo "Changed folders: $changed_folders"
# Step 5: Run the Python script with the list of changed folders and secret key
- name: Run Python script
run: python deploy.py "ldw-key" ${{ secrets.TENANT_ID }} ${{ secrets.APP_ID }} ${{ secrets.SECRET_KEY }} ${{ env.changed_folders }}