Skip to content

Commit 00ad706

Browse files
kytrinyxkotp
authored andcommitted
Update autoresponder for pausing community contributions
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 b74d4de commit 00ad706

File tree

1 file changed

+8
-43
lines changed

1 file changed

+8
-43
lines changed

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

+8-43
Original file line numberDiff line numberDiff line change
@@ -12,48 +12,13 @@ on:
1212
- 'exercises/*/*/.articles/**'
1313
workflow_dispatch:
1414

15+
permissions:
16+
issues: write
17+
pull-requests: write
18+
1519
jobs:
1620
pause:
17-
name: Pause Community Contributions
18-
runs-on: ubuntu-22.04
19-
steps:
20-
- name: Detect if user is org member
21-
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
22-
id: is-organization-member
23-
with:
24-
script: |
25-
if (context.actor == 'dependabot' || context.actor == 'exercism-bot' || context.actor == 'github-actions[bot]') {
26-
return true;
27-
}
28-
29-
return github.rest.orgs.checkMembershipForUser({
30-
org: context.repo.owner,
31-
username: context.actor,
32-
}).then(response => response.status == 204)
33-
.catch(err => true);
34-
- name: Comment
35-
if: steps.is-organization-member.outputs.result == 'false'
36-
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
37-
with:
38-
script: |
39-
const isIssue = !!context.payload.issue;
40-
const subject = context.payload.issue || context.payload.pull_request;
41-
const thing = (isIssue ? 'issue' : 'PR');
42-
const aThing = (isIssue ? 'an issue' : 'a PR');
43-
github.rest.issues.createComment({
44-
issue_number: context.issue.number,
45-
owner: context.repo.owner,
46-
repo: context.repo.repo,
47-
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=ruby) 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`
48-
})
49-
- name: Close
50-
if: steps.is-organization-member.outputs.result == 'false'
51-
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
52-
with:
53-
script: |
54-
github.rest.issues.update({
55-
owner: context.repo.owner,
56-
repo: context.repo.repo,
57-
issue_number: context.issue.number,
58-
state: 'closed',
59-
})
21+
if: github.repository_owner == 'exercism' # Stops this job from running on forks
22+
uses: exercism/github-actions/.github/workflows/community-contributions.yml@main
23+
with:
24+
forum_category: ruby

0 commit comments

Comments
 (0)