-
Notifications
You must be signed in to change notification settings - Fork 368
81 lines (71 loc) · 3.12 KB
/
Copy pathgreet-and-label.yml
File metadata and controls
81 lines (71 loc) · 3.12 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Greet and Guide for Issues and PRs
on:
issues:
types: [opened]
pull_request:
types: [opened]
jobs:
issue_greet_label_assign:
if: github.event_name == 'issues'
runs-on: ubuntu-latest
steps:
- name: Add 'gssoc2025' label
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: gssoc2025
- name: Assign issue opener
uses: actions-ecosystem/action-add-assignees@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
assignees: ${{ github.event.issue.user.login }}
- name: Greet and post guidelines for Issue
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const guidelines = `
👋 Hi @${{ github.event.issue.user.login }}! Thanks for opening this issue.
**Contributor Guidelines**
1. Make sure your issue is clear and descriptive.
2. If you are reporting a bug, please include steps to reproduce it.
3. If suggesting a feature, explain why it would be beneficial.
4. Be respectful and constructive in your comments.
5. Review our [Contributing Guide](https://github.com/opensource-society/notesvault/blob/main/CONTRIBUTING.md) for more details.
Good luck contributing to NotesVault! 🚀
`;
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: guidelines
});
pr_greet_guidelines:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Greet and post guidelines for PR
if: github.event.pull_request.head.repo.full_name == github.repository
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const guidelines = `
👋 Hi @${{ github.event.pull_request.user.login }}! Thanks for opening this pull request.
**Contributor Guidelines**
1. Please make sure your PR description is clear and links to related issues if applicable.
2. Ensure your code follows our style guide and passes all tests.
3. Be respectful and constructive in your comments and reviews.
4. Review our [Contributing Guide](https://github.com/opensource-society/notesvault/blob/main/CONTRIBUTING.md) for more details.
Good luck contributing to NotesVault! 🚀
`;
await github.rest.issues.createComment({
issue_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: guidelines
})
- name: Skip greeting for forked PRs
if: github.event.pull_request.head.repo.full_name != github.repository
run: |
echo "Skipping comment: this pull request comes from a fork. GITHUB_TOKEN has limited permissions for forked PRs."