-
Notifications
You must be signed in to change notification settings - Fork 191
59 lines (48 loc) · 2.08 KB
/
NewContributors.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Distributed under the MIT License.
# See LICENSE.txt for details.
# Add new contributors when their first PR was merged
name: New contributors
on:
pull_request:
branches: [develop]
types: [closed]
jobs:
new_contributors:
if: github.event.pull_request.merged == true
name: Notify
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check PR author is new
id: check_pr_author
shell: python
run: |
import yaml
def all_authors():
authors = yaml.safe_load(open('Metadata.yaml', 'r'))['Authors']
for tier in ['Core', 'Developers', 'Contributors']:
for author in authors[tier]['List']:
yield author['GitHub']
pr_author = '${{ github.event.pull_request.user.login }}'
if pr_author not in all_authors():
print('::set-output name=is_new::true')
- name: Comment on PR
if: steps.check_pr_author.outputs.is_new
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: > # Newlines are line breaks, body renders as GitHub markdown
@${{ github.event.pull_request.user.login }} looks like this is your
first contribution to SpECTRE. Welcome! 🎉 Your contribution
is much appreciated, and we invite you to add your name to the
author list:
1. Edit the [`Metadata.yaml`](https://github.com/${{ github.event.pull_request.user.login }}/spectre/blob/develop/Metadata.yaml)
file in the repository.
2. Add an entry to the list in `Authors.Contributors` with your
name, affiliation, etc. Note that the list is ordered
alphabetically by last name.
3. Commit the change on a new branch and open a pull request with
the change.
Once the pull request is merged, your name will appear on the
[SpECTRE DOI on Zenodo](https://doi.org/10.5281/zenodo.4290404)
with the next public release.