Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3f92623

Browse filesBrowse files
authored
Merge pull request actions#74 from ahmadnassri/patch-1
docs: use GITHUB_WORKSPACE environment variable
2 parents 83107c8 + 07ecbc5 commit 3f92623
Copy full SHA for 3f92623

File tree

Expand file treeCollapse file tree

1 file changed

+4
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-5
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,16 @@ jobs:
198198
- uses: actions/github-script@v2
199199
with:
200200
script: |
201-
const path = require('path')
202-
const scriptPath = path.resolve('./path/to/script.js')
203-
console.log(require(scriptPath)({context}))
201+
const script = require(`${process.env.GITHUB_WORKSPACE}/path/to/script.js`)
202+
console.log(script({github, context}))
204203
```
205204

206-
*Note that the script path given to `require()` must be an absolute path in this case, hence the call to `path.resolve()`.*
205+
*Note that the script path given to `require()` must be an **absolute path** in this case, hence using [`GITHUB_WORKSPACE`](https://docs.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables).*
207206

208207
And then export a function from your module:
209208

210209
```javascript
211-
module.exports = ({context}) => {
210+
module.exports = (github, context) => {
212211
return context.payload.client_payload.value
213212
}
214213
```

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.