Skip to content

Commit d910cb8

Browse files
authored
Merge pull request #4 from JJ/master
Adds example that uses the github object
2 parents 4768300 + 4404120 commit d910cb8

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 a 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/[email protected]
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)