Skip to content

Commit a72f6a9

Browse files
authored
Create autoresponder for pausing community contributions (#36)
1 parent e152e09 commit a72f6a9

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Pause Community Contributions
2+
3+
on:
4+
issues:
5+
types:
6+
- opened
7+
pull_request_target:
8+
types:
9+
- opened
10+
workflow_dispatch:
11+
12+
jobs:
13+
pause:
14+
name: Pause Community Contributions
15+
runs-on: ubuntu-22.04
16+
steps:
17+
- name: Detect if user is org member
18+
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
19+
id: is-organization-member
20+
with:
21+
script: |
22+
if (context.actor == 'dependabot' || context.actor == 'exercism-bot' || context.actor == 'github-actions[bot]') {
23+
return true;
24+
}
25+
26+
return github.rest.orgs.checkMembershipForUser({
27+
org: context.repo.owner,
28+
username: context.actor,
29+
}).then(response => response.status == 204)
30+
.catch(err => true);
31+
- name: Comment
32+
if: steps.is-organization-member.outputs.result == 'false'
33+
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
34+
with:
35+
script: |
36+
const isIssue = !!context.payload.issue;
37+
const subject = context.payload.issue || context.payload.pull_request;
38+
const thing = (isIssue ? 'issue' : 'PR');
39+
const aThing = (isIssue ? 'an issue' : 'a PR');
40+
github.rest.issues.createComment({
41+
issue_number: context.issue.number,
42+
owner: context.repo.owner,
43+
repo: context.repo.repo,
44+
body: `Hello. Thanks for opening ${aThing} on Exercism. We are currently in a phase of our journey where we have paused community contributions to allow us to take a breather and redesign our community model. You can learn more in [this blog post](https://exercism.org/blog/freeing-our-maintainers). **As such, all issues and PRs in this repository are being automatically closed.**\n\nThat doesn’t mean we’re not interested in your ideas, or that if you’re stuck on something we don’t want to help. The best place to discuss things is with our community on the Exercism Community Forum. You can use [this link](https://forum.exercism.org/new-topic?title=${encodeURI(subject.title)}&body=${encodeURI(subject.body)}&category=support) to copy this into a new topic there.\n\n---\n\n_Note: If this ${thing} has been pre-approved, please link back to this ${thing} on the forum thread and a maintainer or staff member will reopen it._\n`
45+
})
46+
- name: Close
47+
if: steps.is-organization-member.outputs.result == 'false'
48+
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
49+
with:
50+
script: |
51+
github.rest.issues.update({
52+
owner: context.repo.owner,
53+
repo: context.repo.repo,
54+
issue_number: context.issue.number,
55+
state: 'closed',
56+
})

0 commit comments

Comments
 (0)