Skip to content

Commit 366b002

Browse files
Update README.md to clarify script path usage for custom actions and improve guidance on path resolution
1 parent fc8d080 commit 366b002

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,15 @@ jobs:
6666
- name: Run script
6767
uses: PSModule/GitHub-Script@v1
6868
with:
69-
Script: scripts/main.ps1
69+
Script: ${{ github.action_path }}/scripts/main.ps1
7070
```
7171

72+
> [!IMPORTANT]
73+
> Use `${{ github.action_path }}/<pathToScript.ps1>` if you are creation an action of your own using this action as a step. This will ensure that
74+
> the path to the script is from the calling action, and not the `GitHub-Script` action repo. Using `$env:GITHUB_ACTION_PATH` may have mixed results
75+
> 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
76+
> processed by the runner.
77+
7278
The `Script` supports the following formats:
7379

7480
- Inline script, although it is recommended to use a script file for better tooling support and linting capabilities.
@@ -82,12 +88,6 @@ The `Script` supports the following formats:
8288
- `. '.\scripts\main.ps1'`
8389
- `. './scripts/main.ps1'`
8490

85-
> [!IMPORTANT]
86-
> Use `${{ github.action_path }}/<pathToScript.ps1>` if you are creation an action of your own using this action as a step. This will ensure that
87-
> the path to the script is from the calling action, and not the `GitHub-Script` action repo. Using `$env:GITHUB_ACTION_PATH` may have mixed results
88-
> when you nest actions inside one another. The context syntax will be expanded to the correct path at runtime.
89-
90-
9191
> [!WARNING]
9292
> Using `tests\info.ps1` is PowerShell syntax for calling a function under a specific module, i.e. `Microsoft.PowerShell.Management\Get-ChildItem`.
9393

0 commit comments

Comments
 (0)