Skip to content

Commit 6e5ee1d

Browse files
authored
Merge pull request #57 from actions/update-actions/github
Update actions/github
2 parents 89e3c40 + fa718ed commit 6e5ee1d

File tree

7 files changed

+7512
-23260
lines changed

7 files changed

+7512
-23260
lines changed
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
on:
2+
pull_request:
3+
branches: master
4+
types: [opened, synchronize]
5+
6+
jobs:
7+
pull-request-test:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: ./
12+
with:
13+
script: |
14+
// Get the existing comments.
15+
const {data: comments} = await github.issues.listComments({
16+
owner: context.repo.owner,
17+
repo: context.repo.repo,
18+
issue_number: context.payload.number,
19+
})
20+
21+
// Find any comment already made by the bot.
22+
const botComment = comments.find(comment => comment.user.id === 41898282)
23+
const commentBody = "Hello from actions/github-script! (${{ github.sha }})"
24+
25+
if (botComment) {
26+
await github.issues.updateComment({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
comment_id: botComment.id,
30+
body: commentBody
31+
})
32+
} else {
33+
await github.issues.createComment({
34+
owner: context.repo.owner,
35+
repo: context.repo.repo,
36+
issue_number: context.payload.number,
37+
body: commentBody
38+
})
39+
}

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The return value of the script will be in the step's outputs under the
3333
"result" key.
3434

3535
```yaml
36-
- uses: actions/github-script@v1
36+
- uses: actions/github-script@v2
3737
id: set-result
3838
with:
3939
script: return "Hello!"
@@ -52,7 +52,7 @@ output of a github-script step. For some workflows, string encoding is preferred
5252
`result-encoding` input:
5353

5454
```yaml
55-
- uses: actions/github-script@v1
55+
- uses: actions/github-script@v2
5656
id: my-script
5757
with:
5858
github-token: ${{secrets.GITHUB_TOKEN}}
@@ -78,7 +78,7 @@ jobs:
7878
comment:
7979
runs-on: ubuntu-latest
8080
steps:
81-
- uses: actions/github-script@v1
81+
- uses: actions/github-script@v2
8282
with:
8383
github-token: ${{secrets.GITHUB_TOKEN}}
8484
script: |
@@ -101,7 +101,7 @@ jobs:
101101
apply-label:
102102
runs-on: ubuntu-latest
103103
steps:
104-
- uses: actions/github-script@v1
104+
- uses: actions/github-script@v2
105105
with:
106106
github-token: ${{secrets.GITHUB_TOKEN}}
107107
script: |
@@ -122,7 +122,7 @@ jobs:
122122
welcome:
123123
runs-on: ubuntu-latest
124124
steps:
125-
- uses: actions/github-script@v1
125+
- uses: actions/github-script@v2
126126
with:
127127
github-token: ${{secrets.GITHUB_TOKEN}}
128128
script: |
@@ -166,7 +166,7 @@ jobs:
166166
diff:
167167
runs-on: ubuntu-latest
168168
steps:
169-
- uses: actions/github-script@v1
169+
- uses: actions/github-script@v2
170170
with:
171171
github-token: ${{secrets.GITHUB_TOKEN}}
172172
script: |
@@ -195,7 +195,7 @@ jobs:
195195
runs-on: ubuntu-latest
196196
steps:
197197
- uses: actions/checkout@v2
198-
- uses: actions/github-script@v1
198+
- uses: actions/github-script@v2
199199
with:
200200
script: |
201201
const path = require('path')

0 commit comments

Comments
 (0)