-
Notifications
You must be signed in to change notification settings - Fork 2
36 lines (34 loc) · 1.2 KB
/
heart-it.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Add Emoji Reaction To Comments
on:
issue_comment:
types: [created, edited]
jobs:
add_emoji:
runs-on: ubuntu-latest
steps:
- name: Add heart reaction to comment
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
if (context.payload.comment.user.login !== 'Hannes-Leitl-Senacor') {
console.log('The comment is not by Hannes, skipping...');
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: '+1',
});
} else {
try {
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: 'heart',
});
console.log('Heart reaction added to the comment.');
} catch (error) {
console.error('Failed to add reaction', error);
}
}