Skip to content

Commit c27855e

Browse files
committed
Allow to specify the office apps in the inputs
1 parent 3d9a9e5 commit c27855e

File tree

3 files changed

+33
-13
lines changed

3 files changed

+33
-13
lines changed

.github/workflows/tests_access.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ jobs:
2525
with:
2626
source-dir: "./tests_access" # Don't build anything, but include the setup part of the action
2727
test-framework: "none"
28+
office-apps: "Access"
2829
timeout-minutes: 20
2930
- name: "Build Access Database (using msaccess-vcs-build action)"
3031
id: build_access_file
3132
uses: AccessCodeLib/msaccess-vcs-build@main
3233
with:
33-
source-dir: "./tests_access/AccessDatabase1"
34+
source-dir: "./tests_access/source"
3435
target-dir: "./tests_access/out"
3536
compile: "false"
3637
vcs-url: "https://api.github.com/repos/josef-poetzl/msaccess-vcs-addin/releases/tags/v4.1.2-build"

Main.ps1

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Get the source directory from command line argument or use default "src"
22
param(
33
[string]$SourceDir = "src",
4-
[string]$TestFramework = "none" # Default to "none" if not specified
4+
[string]$TestFramework = "none", # Default to "none" if not specified
5+
[string]$OfficeApp = "automatic" # Default to "automatic" if not specified
56
)
67

78
Write-Host "Current directory: $(pwd)"
@@ -35,21 +36,35 @@ function Get-OfficeApp {
3536
}
3637
}
3738

38-
# Create a list of Office applications that are needed based on the file extensions of the folders
39-
foreach ($folder in $folders) {
40-
$FileExtension = $folder.Substring($folder.LastIndexOf('.') + 1)
41-
$app = Get-OfficeApp -FileExtension $FileExtension
42-
43-
if ($app) {
44-
if ($officeApps -notcontains $app) {
45-
$officeApps += $app
39+
if ($OfficeApp -ieq "automatic") {
40+
41+
# Create a list of Office applications that are needed based on the file extensions of the folders
42+
foreach ($folder in $folders) {
43+
$FileExtension = $folder.Substring($folder.LastIndexOf('.') + 1)
44+
$app = Get-OfficeApp -FileExtension $FileExtension
45+
46+
if ($app) {
47+
if ($officeApps -notcontains $app) {
48+
$officeApps += $app
49+
}
50+
} else {
51+
Write-Host "Unknown file extension: $FileExtension. Skipping..."
52+
continue
4653
}
47-
} else {
48-
Write-Host "Unknown file extension: $FileExtension. Skipping..."
49-
continue
54+
}
55+
56+
} else {
57+
# We parse the OfficeApp parameter to get the list of Office applications
58+
$officeApps = $OfficeApp -split ","
59+
$officeApps = $officeApps | ForEach-Object { $_.Trim() }
60+
$officeApps = $officeApps | Where-Object { $_ -in @("Excel", "Word", "PowerPoint", "Access") }
61+
if ($officeApps.Count -eq 0) {
62+
Write-Host "No valid Office applications specified. Exiting script."
63+
exit 1
5064
}
5165
}
5266

67+
5368
# We need to open and close the Office applications before we can enable VBOM
5469
Write-Host "Open and close Office applications"
5570
. "$PSScriptRoot/scripts/Open-Close-Office.ps1" $officeApps

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ inputs:
1414
description: 'The test framework to use for the build process.'
1515
required: false
1616
default: 'none'
17+
office-apps:
18+
description: 'A list of the Office applications to install seperated by commas. Options: Excel, Word, PowerPoint, Access'
19+
required: false
20+
default: 'automatic'
1721

1822
runs:
1923
using: "composite"

0 commit comments

Comments
 (0)