-
Notifications
You must be signed in to change notification settings - Fork 15
42 lines (37 loc) · 1.26 KB
/
append_note_in_issue.yml
File metadata and controls
42 lines (37 loc) · 1.26 KB
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
37
38
39
40
41
42
name: Add Custom Note to Issues Created By Maintainers
on:
issues:
types: [opened]
jobs:
add-note:
if: github.event.issue.user.login == 'o2sa'
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Append Note to Issue
uses: actions/github-script@v7
with:
script: |
const issue_number = context.payload.issue.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
// The custom note you want to append
const note = [
'',
'> [!TIP]',
'> 🚀 **Want to contribute?**',
'> Comment `assign me` to be automatically assigned to this issue via our GitHub Actions bot. Happy coding! ✨'
].join('\n');
// Get the current issue body
const currentBody = context.payload.issue.body || '';
// Only edit if the note isn't already present
if (!currentBody.includes('CONTRIBUTIONS ARE WELCOME')) {
const newBody = currentBody + note;
await github.rest.issues.update({
owner,
repo,
issue_number,
body: newBody
});
}