Update alternative-setup.md

This commit is contained in:
Viktorlo
2023-07-28 11:34:17 +02:00
committed by GitHub
parent ba13a89bc9
commit c857fcb22b

View File

@@ -13,7 +13,7 @@ root # Your repository
├── ... ├── ...
├── actions ├── actions
│ ├── action.yml (optional) │ ├── action.yml (optional)
│ └── ci-test.js │ └── ci-test.mjs
├── ... ├── ...
└── package.json └── package.json
``` ```
@@ -57,7 +57,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string result-encoding: string
script: | script: |
const { default: script } = await import('${{ github.workspace }}/actions/ci-test.js'); const { default: script } = await import('${{ github.workspace }}/actions/ci-test.mjs');
return await script({ github, context, core, exec, glob, io, fetch, __original_require__ }); return await script({ github, context, core, exec, glob, io, fetch, __original_require__ });
``` ```
@@ -76,7 +76,7 @@ branding:
icon: code icon: code
inputs: inputs:
script: script:
description: The path to script (e.g actions/ci-test.js) description: The path to script (e.g actions/ci-test.mjs)
required: true required: true
github-token: github-token:
description: The GitHub token used to create an authenticated client description: The GitHub token used to create an authenticated client
@@ -125,7 +125,7 @@ runs:
### The `ci-workflow.yml` file ### The `ci-workflow.yml` file
Note that we only need to specify the script here because the path will be Note that we only need to specify the script name here because the path will be
resolved to the `uses: ./actions` path by `process.env.GITHUB_ACTION_PATH`. resolved to the `uses: ./actions` path by `process.env.GITHUB_ACTION_PATH`.
i.e the same folder as we are executing the action from. i.e the same folder as we are executing the action from.
```yml ```yml
@@ -149,6 +149,6 @@ jobs:
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string result-encoding: string
script: ci-test.js script: ci-test.mjs
``` ```