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 4789b35

Browse filesBrowse files
committed
Add pull-request-test workflow
1 parent 89e3c40 commit 4789b35
Copy full SHA for 4789b35

File tree

Expand file treeCollapse file tree

6 files changed

+7503
-23251
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+7503
-23251
lines changed
+39Lines changed: 39 additions & 0 deletions
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+
}

0 commit comments

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