Skip to content

Commit a785a70

Browse files
authored
Update autoresponder for pausing community contributions (#37)
We realized belatedly that we should create a shared, re-usable workflow. This simplifies the workflow logic using a variable for the forum category that the new topic gets created in, if they click the link to copy their post from here to the forum.
1 parent a72f6a9 commit a785a70

File tree

1 file changed

+8
-43
lines changed

1 file changed

+8
-43
lines changed

.github/workflows/pause-community-contributions.yml

Lines changed: 8 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,48 +9,13 @@ on:
99
- opened
1010
workflow_dispatch:
1111

12+
permissions:
13+
issues: write
14+
pull-requests: write
15+
1216
jobs:
1317
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-
})
18+
if: github.repository_owner == 'exercism' # Stops this job from running on forks
19+
uses: exercism/github-actions/.github/workflows/community-contributions.yml@main
20+
with:
21+
forum_category: support

0 commit comments

Comments
 (0)