diff --git a/README.md b/README.md
index 37c9921..bdd3ed5 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
# CLI for Microsoft 365 Runscript
+
GitHub action to run a script using the CLI for Microsoft 365

@@ -6,20 +7,25 @@ GitHub action to run a script using the CLI for Microsoft 365
This GitHub Action (created using typescript) uses [CLI for Microsoft 365](https://pnp.github.io/cli-microsoft365/), to run a line of script supplied to it or run code in a script file supplied to it.
## Usage
+
### Pre-requisites
+
Create a workflow `.yml` file in `.github/workflows` directory of your repo. An [example workflow](#example-workflow---cli-for-microsoft-365-runscript) is available below. For more information, reference the GitHub Help Documentation for [Creating a workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file).
## Dependencies on other GitHub Actions
- [CLI for Microsoft 365 Login](https://github.com/pnp/action-cli-login) – **Required** . This action is dependant on `action-cli-login`. So in the workflow we need to run `action-cli-login` before using this action.
-#### Optional requirement
+### Optional requirement
+
Since `action-cli-login` requires user name and password which are sensitive pieces of information, it would be ideal to store them securely. We can achieve this in a GitHub repo by using [secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets). So, click on `settings` tab in your repo and add 2 new secrets:
+
- `adminUsername` - store the admin user name in this (e.g. user@contoso.onmicrosoft.com)
- `adminPassword` - store the password of that user in this.
These secrets are encrypted and can only be used by GitHub actions.
### Inputs
+
- `CLI_MICROSOFT365_SCRIPT_PATH` : Relative path of the script in your repo.
- `CLI_MICROSOFT365_SCRIPT` : The script to run
- `IS_POWERSHELL` : `true|false` Used only with CLI_MICROSOFT365_SCRIPT. If true the assumption is the script passed in CLI_MICROSOFT365_SCRIPT will be a PowerShell script, otherwise the assumption is bash script. Default is false
@@ -27,6 +33,7 @@ These secrets are encrypted and can only be used by GitHub actions.
One of `CLI_MICROSOFT365_SCRIPT_PATH` / `CLI_MICROSOFT365_SCRIPT` is mandatory, in case both are defined `CLI_MICROSOFT365_SCRIPT_PATH` gets preference.
### Example workflow - CLI for Microsoft 365 Runscript
+
On every `push` build the code, then deploy and then send an email using CLI for Microsoft 365 Runscript action.
```yaml
@@ -40,36 +47,41 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- node-version: [18.x]
+ node-version: [24]
steps:
# CLI for Microsoft 365 login action
- name: Login to tenant
- uses: pnp/action-cli-login@v3
+ uses: pnp/action-cli-login@v4
with:
ADMIN_USERNAME: ${{ secrets.adminUsername }}
ADMIN_PASSWORD: ${{ secrets.adminPassword }}
# CLI for Microsoft 365 runscript action option 1 (single line of script as input)
- name: Send email
- uses: pnp/action-cli-runscript@v3
+ uses: pnp/action-cli-runscript@v4
with:
- CLI_MICROSOFT365_SCRIPT: m365 spo mail send --webUrl https://contoso.sharepoint.com/sites/teamsite --to 'user@contoso.onmicrosoft.com' --subject 'Deployment done' --body '
CLI for Microsoft 365
The deployment is complete.
Email sent via CLI for Microsoft 365 GitHub Action.'
+ CLI_MICROSOFT365_SCRIPT: m365 outlook mail send --to 'john.doe@contoso.onmicrosoft.com' --subject 'Deployment done' --bodyContents 'CLI for Microsoft 365
The deployment is complete.
Email sent via CLI for Microsoft 365 GitHub Action.' --bodyContentType HTML
# CLI for Microsoft 365 runscript action option 2 (script file as input)
- name: Create lists
- uses: pnp/action-cli-runscript@v3
+ uses: pnp/action-cli-runscript@v4
with:
CLI_MICROSOFT365_SCRIPT_PATH: ./script/lists.ps1
#lists.ps1 will have all the required CLI for Microsoft 365 commands
```
#### Self-hosted runners
-If self-hosted runners are used for running the workflow, then please make sure that they have `PowerShell` or `bash` installed on them.
+
+If self-hosted runners are used for running the workflow, then please make sure that they have `PowerShell` or `bash` installed on them.
## Release notes
+### v4.0.0
+
+- Bumped to Node version 24
+
### v3.0.0
- Bumped to Node version 20
@@ -79,4 +91,5 @@ If self-hosted runners are used for running the workflow, then please make sure
- Renames action to 'CLI for Microsoft 365 Runscript'
### v1.0.0
-- Added initial 'CLI for Microsoft 365 runscript' GitHub action solving #2
\ No newline at end of file
+
+- Added initial 'CLI for Microsoft 365 runscript' GitHub action solving #2
diff --git a/action.yml b/action.yml
index 0ba1e79..cb36c2f 100644
--- a/action.yml
+++ b/action.yml
@@ -4,11 +4,11 @@ inputs:
CLI_MICROSOFT365_SCRIPT_PATH:
description: 'Relative path of the script in your repo.'
CLI_MICROSOFT365_SCRIPT:
- description: 'CLI for Microsoft 365 Script'
+ description: 'CLI for Microsoft 365 Script.'
IS_POWERSHELL:
- description: 'Used only with CLI_MICROSOFT365_SCRIPT. If true the assumption is the script passed in CLI_MICROSOFT365_SCRIPT will be a PowerShell script, otherwise the assumption is bash script. Default is false'
+ description: 'Used only with CLI_MICROSOFT365_SCRIPT. If true the assumption is the script passed in CLI_MICROSOFT365_SCRIPT will be a PowerShell script, otherwise the assumption is bash script. Default is false.'
runs:
- using: "node20"
+ using: "node24"
main: "dist/index.js"
branding:
icon: 'terminal'
diff --git a/package-lock.json b/package-lock.json
index c2c5c0b..cdfcdd5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@pnp/action-cli-runscript",
- "version": "3.0.0",
+ "version": "4.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@pnp/action-cli-runscript",
- "version": "3.0.0",
+ "version": "4.0.0",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.6.0",
@@ -14,7 +14,7 @@
"@actions/io": "^1.1.1"
},
"devDependencies": {
- "@types/node": "^16.11.6",
+ "@types/node": "^24.10.4",
"@vercel/ncc": "^0.31.1",
"typescript": "^4.4.4"
}
@@ -49,10 +49,14 @@
"integrity": "sha512-Qi4JoKXjmE0O67wAOH6y0n26QXhMKMFo7GD/4IXNVcrtLjUlGjGuVys6pQgwF3ArfGTQu0XpqaNr0YhED2RaRA=="
},
"node_modules/@types/node": {
- "version": "16.11.6",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz",
- "integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==",
- "dev": true
+ "version": "24.10.4",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.4.tgz",
+ "integrity": "sha512-vnDVpYPMzs4wunl27jHrfmwojOGKya0xyM3sH+UE5iv5uPS6vX7UIoh6m+vQc5LGBq52HBKPIn/zcSZVzeDEZg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": "~7.16.0"
+ }
},
"node_modules/@vercel/ncc": {
"version": "0.31.1",
@@ -83,6 +87,13 @@
"engines": {
"node": ">=4.2.0"
}
+ },
+ "node_modules/undici-types": {
+ "version": "7.16.0",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
+ "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
+ "dev": true,
+ "license": "MIT"
}
},
"dependencies": {
@@ -116,10 +127,13 @@
"integrity": "sha512-Qi4JoKXjmE0O67wAOH6y0n26QXhMKMFo7GD/4IXNVcrtLjUlGjGuVys6pQgwF3ArfGTQu0XpqaNr0YhED2RaRA=="
},
"@types/node": {
- "version": "16.11.6",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz",
- "integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==",
- "dev": true
+ "version": "24.10.4",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.4.tgz",
+ "integrity": "sha512-vnDVpYPMzs4wunl27jHrfmwojOGKya0xyM3sH+UE5iv5uPS6vX7UIoh6m+vQc5LGBq52HBKPIn/zcSZVzeDEZg==",
+ "dev": true,
+ "requires": {
+ "undici-types": "~7.16.0"
+ }
},
"@vercel/ncc": {
"version": "0.31.1",
@@ -137,6 +151,12 @@
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz",
"integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==",
"dev": true
+ },
+ "undici-types": {
+ "version": "7.16.0",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
+ "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
+ "dev": true
}
}
}
diff --git a/package.json b/package.json
index 57dc849..137d7ef 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@pnp/action-cli-runscript",
- "version": "3.0.0",
+ "version": "4.0.0",
"description": "A GitHub Action that runs a CLI for Microsoft 365 script",
"main": "dist/index.js",
"scripts": {
@@ -108,7 +108,7 @@
"@actions/io": "^1.1.1"
},
"devDependencies": {
- "@types/node": "^16.11.6",
+ "@types/node": "^24.10.4",
"@vercel/ncc": "^0.31.1",
"typescript": "^4.4.4"
}