-
-
Notifications
You must be signed in to change notification settings - Fork 11
60 lines (53 loc) · 2.74 KB
/
ping-cross-track-maintainers-team.yml
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
name: Ping cross-track maintainers team
on:
workflow_call:
secrets:
github_membership_token:
description: "The github token used to check team membership with"
required: false
permissions:
pull-requests: write
jobs:
ping:
name: Ping team
runs-on: ubuntu-22.04
steps:
- name: Check if repo is unmaintained
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
id: ping-cross-track-maintainers
with:
script: |
const response = await github.rest.repos.getAllTopics({
owner: context.repo.owner,
repo: context.repo.repo,
});
return response.data.names.includes('unmaintained') ||
response.data.names.includes('maintained-solitary');
- name: Check if user is cross-track maintainer
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
id: author-is-cross-track-maintainer
if: steps.ping-cross-track-maintainers.outputs.result == 'true'
with:
github-token: ${{ secrets.github_membership_token || secrets.GITHUB_TOKEN }}
script: |
// Uncomment this if we don't want to ping when the PR is created by a bot
// if (context.actor == 'dependabot[bot]' || context.actor == 'exercism-bot' || context.actor == 'github-actions[bot]') {
// return true;
//}
return github.rest.teams.getMembershipForUserInOrg({
org: context.repo.owner,
team_slug: 'cross-track-maintainers',
username: context.actor,
}).then(response => true)
.catch(err => false);
- name: Create comment
if: steps.ping-cross-track-maintainers.outputs.result == 'true' && steps.author-is-cross-track-maintainer.outputs.result == 'false'
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Hello 👋 Thanks for your PR.\n\nThis repo does not currently have dedicated maintainers. Our cross-track maintainers team will attempt to review and merge your PR, but it will likely take longer for your PR to be reviewed.\n\nIf you enjoy contributing to Exercism and have a track-record of doing so successfully, you might like to become an Exercism maintainer for this track.\n\nPlease feel free to ask any questions, or chat to us about anything to do with this PR or the reviewing process on the [Exercism forum](https://exercism.org/r/forum).\n\n_(cc @exercism/cross-track-maintainers)_`
})