Skip to content

Commit 080afc8

Browse files
authored
Update autoclose.yml
1 parent 102c1f9 commit 080afc8

File tree

1 file changed

+3
-53
lines changed

1 file changed

+3
-53
lines changed

.github/workflows/autoclose.yml

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,56 +6,6 @@ on:
66

77
jobs:
88
auto_close:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- name: Check if user is organization member
12-
id: check-membership
13-
uses: actions/github-script@v7
14-
with:
15-
github-token: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }}
16-
script: |
17-
const org = 'Appwrite';
18-
let isMember = 'non-member';
19-
try {
20-
await github.rest.orgs.checkMembershipForUser({
21-
org: org,
22-
username: context.payload.pull_request.user.login
23-
});
24-
console.log('PR author is a core member. Keeping PR open.');
25-
isMember = 'member';
26-
} catch (error) {
27-
console.log('PR author is not a core member.');
28-
}
29-
return isMember;
30-
result-encoding: string
31-
32-
- name: Set member output
33-
id: set-output
34-
run: echo "result=${{ steps.check-membership.outputs.result }}" >> $GITHUB_ENV
35-
36-
- name: Comment on PR
37-
if: env.result == 'non-member'
38-
uses: actions/github-script@v7
39-
with:
40-
github-token: ${{ secrets.GITHUB_TOKEN }}
41-
script: |
42-
await github.rest.issues.createComment({
43-
issue_number: context.issue.number,
44-
owner: context.repo.owner,
45-
repo: context.repo.repo,
46-
body: 'This library is auto-generated by the Appwrite [SDK Generator](https://github.com/appwrite/sdk-generator), and does not accept pull requests directly. To learn more about how you can help us improve this SDK, please check the [contributing guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before submitting a pull request.'
47-
});
48-
console.log('Comment added to PR.');
49-
- name: Close PR
50-
if: env.result == 'non-member'
51-
uses: actions/github-script@v7
52-
with:
53-
github-token: ${{ secrets.GITHUB_TOKEN }}
54-
script: |
55-
await github.rest.pulls.update({
56-
pull_number: context.issue.number,
57-
owner: context.repo.owner,
58-
repo: context.repo.repo,
59-
state: 'closed'
60-
});
61-
console.log('PR closed.');
9+
uses: appwrite/.github/.github/workflows/autoclose.yml@main
10+
secrets:
11+
GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }}

0 commit comments

Comments
 (0)