Skip to content

Commit a69aced

Browse files
committed
Allow installing a different build of Microsoft PowerPoint app
1 parent 2f376e0 commit a69aced

File tree

4 files changed

+46
-14
lines changed

4 files changed

+46
-14
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222

2323
- name: Install Microsoft PowerPoint for Mac
2424
uses: NetOfficeFw/setup-powerpoint@v1
25+
# Optional: install a different Microsoft PowerPoint release
26+
# with:
27+
# package: Microsoft_PowerPoint_16.103.25113013_Updater.pkg
2528

2629
- name: Run automation
2730
run: |

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ author: 'Cisco Systems, Inc.'
44
branding:
55
icon: play
66
color: orange
7+
inputs:
8+
package:
9+
description: 'Optional custom Microsoft PowerPoint installer package name (.pkg)'
10+
required: false
11+
default: 'Microsoft_PowerPoint_16.103.25113013_Updater.pkg'
712
runs:
813
using: 'node24'
914
main: 'dist/index.js'

dist/index.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31050,9 +31050,8 @@ var tool_cache = __nccwpck_require__(3472);
3105031050

3105131051

3105231052

31053-
const POWERPOINT_PACKAGE_NAME = 'Microsoft_PowerPoint_16.102.25101829_Updater.pkg';
31054-
const INSTALLER_URL =
31055-
`https://officecdn.microsoft.com/pr/C1297A47-86C4-4C1F-97FA-950631F94777/MacAutoupdate/${POWERPOINT_PACKAGE_NAME}`;
31053+
const POWERPOINT_PACKAGE_NAME = 'Microsoft_PowerPoint_16.103.25113013_Updater.pkg';
31054+
const DEFAULT_MAC_AUTOUPDATE_BASE_URL = 'https://officecdn.microsoft.com/pr/C1297A47-86C4-4C1F-97FA-950631F94777/MacAutoupdate';
3105631055

3105731056
async function main() {
3105831057
try {
@@ -31074,22 +31073,35 @@ async function run() {
3107431073

3107531074
core.info('Setting up Microsoft PowerPoint for Mac');
3107631075

31077-
const installerPath = await downloadInstaller();
31076+
const installerSource = resolveInstallerSource();
31077+
const installerPath = await downloadInstaller(installerSource);
3107831078
const powerpointAppPath = await installPowerPoint(installerPath);
3107931079
await reportInstalledVersion(powerpointAppPath);
3108031080
await configurePowerPointPolicies();
3108131081
await enableUiAutomation();
3108231082
await dismissPowerPointFirstRunDialogs();
3108331083
}
3108431084

31085-
async function downloadInstaller() {
31085+
function resolveInstallerSource() {
31086+
const packageName = core.getInput('package', { trimWhitespace: true });
31087+
31088+
if (!packageName) {
31089+
core.debug('Using default Microsoft PowerPoint installer package.');
31090+
packageName = POWERPOINT_PACKAGE_NAME;
31091+
}
31092+
31093+
core.info(`Microsoft PowerPoint installer package name: '${packageName}'`);
31094+
return { url: `${DEFAULT_MAC_AUTOUPDATE_BASE_URL}/${packageName}`, packageName: packageName };
31095+
}
31096+
31097+
async function downloadInstaller(installerSource) {
3108631098
core.startGroup('Download Installer');
3108731099
try {
3108831100
core.info(`Downloading Microsoft PowerPoint installer package...`);
3108931101
const tempDirectory = process.env['RUNNER_TEMP'] || external_node_os_namespaceObject.tmpdir();
31090-
const targetPath = external_node_path_namespaceObject.join(tempDirectory, external_node_crypto_.randomUUID(), POWERPOINT_PACKAGE_NAME);
31102+
const targetPath = external_node_path_namespaceObject.join(tempDirectory, external_node_crypto_.randomUUID(), installerSource.packageName);
3109131103

31092-
const downloadedPath = await tool_cache.downloadTool(INSTALLER_URL, targetPath);
31104+
const downloadedPath = await tool_cache.downloadTool(installerSource.url, targetPath);
3109331105
core.info('Installer package downloaded successfully.');
3109431106

3109531107
return downloadedPath;

src/index.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ import * as exec from '@actions/exec';
1212
import * as io from '@actions/io';
1313
import * as tc from '@actions/tool-cache';
1414

15-
const POWERPOINT_PACKAGE_NAME = 'Microsoft_PowerPoint_16.102.25101829_Updater.pkg';
16-
const INSTALLER_URL =
17-
`https://officecdn.microsoft.com/pr/C1297A47-86C4-4C1F-97FA-950631F94777/MacAutoupdate/${POWERPOINT_PACKAGE_NAME}`;
15+
const POWERPOINT_PACKAGE_NAME = 'Microsoft_PowerPoint_16.103.25113013_Updater.pkg';
16+
const DEFAULT_MAC_AUTOUPDATE_BASE_URL = 'https://officecdn.microsoft.com/pr/C1297A47-86C4-4C1F-97FA-950631F94777/MacAutoupdate';
1817

1918
async function main() {
2019
try {
@@ -36,22 +35,35 @@ async function run() {
3635

3736
core.info('Setting up Microsoft PowerPoint for Mac');
3837

39-
const installerPath = await downloadInstaller();
38+
const installerSource = resolveInstallerSource();
39+
const installerPath = await downloadInstaller(installerSource);
4040
const powerpointAppPath = await installPowerPoint(installerPath);
4141
await reportInstalledVersion(powerpointAppPath);
4242
await configurePowerPointPolicies();
4343
await enableUiAutomation();
4444
await dismissPowerPointFirstRunDialogs();
4545
}
4646

47-
async function downloadInstaller() {
47+
function resolveInstallerSource() {
48+
const packageName = core.getInput('package', { trimWhitespace: true });
49+
50+
if (!packageName) {
51+
core.debug('Using default Microsoft PowerPoint installer package.');
52+
packageName = POWERPOINT_PACKAGE_NAME;
53+
}
54+
55+
core.info(`Microsoft PowerPoint installer package name: '${packageName}'`);
56+
return { url: `${DEFAULT_MAC_AUTOUPDATE_BASE_URL}/${packageName}`, packageName: packageName };
57+
}
58+
59+
async function downloadInstaller(installerSource) {
4860
core.startGroup('Download Installer');
4961
try {
5062
core.info(`Downloading Microsoft PowerPoint installer package...`);
5163
const tempDirectory = process.env['RUNNER_TEMP'] || os.tmpdir();
52-
const targetPath = path.join(tempDirectory, crypto.randomUUID(), POWERPOINT_PACKAGE_NAME);
64+
const targetPath = path.join(tempDirectory, crypto.randomUUID(), installerSource.packageName);
5365

54-
const downloadedPath = await tc.downloadTool(INSTALLER_URL, targetPath);
66+
const downloadedPath = await tc.downloadTool(installerSource.url, targetPath);
5567
core.info('Installer package downloaded successfully.');
5668

5769
return downloadedPath;

0 commit comments

Comments
 (0)