@@ -54,7 +54,7 @@ To use the outputs in a subsequent step, you can use the following syntax:
5454
5555### Examples
5656
57- #### Example 1: Run a GitHub PowerShell script
57+ #### Example 1: Run a GitHub PowerShell script file
5858
5959Run a script (` scripts/main.ps1`) that uses the GitHub PowerShell module, authenticated using the `GITHUB_TOKEN`.
6060
6363 Run-Script:
6464 runs-on: ubuntu-latest
6565 steps:
66- - name: Run script
66+ - name: Run inline script - single line
67+ uses: PSModule/GitHub-Script@v1
68+ with:
69+ Script: Get-GitHubPullRequest
70+
71+ - name: Run inline script - multiline
72+ uses: PSModule/GitHub-Script@v1
73+ with:
74+ Script: |
75+ LogGroup 'Get-GitHubPullRequest' {
76+ Get-GitHubPullRequest
77+ }
78+
79+ - name: Run script file - Local repository
80+ uses: PSModule/GitHub-Script@v1
81+ with:
82+ Script: ./scripts/main.ps1
83+
84+ - name: Run script file - In a composite action
6785 uses: PSModule/GitHub-Script@v1
6886 with:
6987 Script: ${{ github.action_path }}/scripts/main.ps1
@@ -75,11 +93,12 @@ jobs:
7593> when you nest actions inside one another. The context syntax will be expanded to the correct path when the job is evaluted by GitHub before it is
7694> processed by the runner.
7795
78- The `Script` supports the following formats :
96+ The `Script` input supports the following formats :
7997
80- - Inline script, although it is recommended to use a script file for better tooling support and linting capabilities.
81- - Multi-line script.
82- - Path to a script file.
98+ - Inline script :
99+ - Single-line
100+ - Multi-line
101+ - Path to a script file. (recommended)
83102 - ` scripts/main.ps1`
84103 - ` .\s cripts\m ain.ps1`
85104 - ` ./scripts/main.ps1`
@@ -91,6 +110,11 @@ The `Script` supports the following formats:
91110> [!WARNING]
92111> Using `tests\info.ps1` is PowerShell syntax for calling a function under a specific module, i.e. `Microsoft.PowerShell.Management\Get-ChildItem`.
93112
113+
114+ > [!TIP]
115+ > Use script files instead of inline scripts for better tooling support and linting capabilities. The PowerShell extension for Visual Studio Code and
116+ > PowerShell linters like PSScriptAnalyzer will work natively with script files.
117+
94118# ### Example 2: Run a GitHub PowerShell script without a token
95119
96120Run a script that uses the GitHub PowerShell module.
0 commit comments