8000 Adds example with use of github object · piotr-struzik/github-script@4418551 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4418551

Browse files
committed
Adds example with use of github object
1 parent e5da67d commit 4418551

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,29 @@ jobs:
9292
9393
await github.issues.createComment({...context.issue, body: 'Welcome, new contributor!'})
9494
```
95+
96+
### Download data from an URL
97+
98+
You can use the `github` object to access the octokit API. For
99+
instance, `github.request`
100+
101+
```
102+
on:
103+
pull_request
104+
105+
jobs:
106+
diff:
107+
runs-on: ubuntu-latest
108+
steps:
109+
- uses: actions/github-script@0.2.0
110+
with:
111+
github-token: ${{github.token}}
112+
script: |
113+
const diff_url = context.payload.pull_request.diff_url
114+
const result = await github.request( diff_url )
115+
console.log( result )
116+
117+
```
118+
119+
This will print the full diff object in the screen; `result.data` will
120+
contain the actual diff text.

0 commit comments

Comments
 (0)
0