From 4418551f1d85d7528c8953aa54f7b8b3a7d2871d Mon Sep 17 00:00:00 2001 From: JJ Merelo Date: Fri, 6 Sep 2019 09:15:54 +0200 Subject: [PATCH 1/3] Adds example with use of github object --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 9f244cb11..767fd3d84 100644 --- a/README.md +++ b/README.md @@ -92,3 +92,29 @@ jobs: await github.issues.createComment({...context.issue, body: 'Welcome, new contributor!'}) ``` + +### Download data from an URL + +You can use the `github` object to access the octokit API. For +instance, `github.request` + +``` +on: + pull_request + +jobs: + diff: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@0.2.0 + with: + github-token: ${{github.token}} + script: | + const diff_url = context.payload.pull_request.diff_url + const result = await github.request( diff_url ) + console.log( result ) + +``` + +This will print the full diff object in the screen; `result.data` will +contain the actual diff text. From 1d11b7fefb90fc33c47f5c3a85574ca750f33930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Juli=C3=A1n=20Merelo=20Guerv=C3=B3s?= Date: Tue, 17 Sep 2019 21:39:56 +0200 Subject: [PATCH 2/3] Update README.md as requested Co-Authored-By: Jonathan Clem --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 767fd3d84..f603b0e1d 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ jobs: await github.issues.createComment({...context.issue, body: 'Welcome, new contributor!'}) ``` -### Download data from an URL +### Download data from a URL You can use the `github` object to access the octokit API. For instance, `github.request` From 44041204325a57110adf8f41fff8603cb19eb22b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Juli=C3=A1n=20Merelo=20Guerv=C3=B3s?= Date: Tue, 17 Sep 2019 21:40:17 +0200 Subject: [PATCH 3/3] Update README.md as requested Co-Authored-By: Jonathan Clem --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f603b0e1d..9eca7d227 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ jobs: ### Download data from a URL -You can use the `github` object to access the octokit API. For +You can use the `github` object to access the Octokit API. For instance, `github.request` ```