Skip to content

Commit 9d5dfb1

Browse files
authored
Update autoclose.yml
1 parent 229324b commit 9d5dfb1

File tree

1 file changed

+3
-54
lines changed

1 file changed

+3
-54
lines changed

.github/workflows/autoclose.yml

+3-54
Original file line numberDiff line numberDiff line change
@@ -6,57 +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-
50-
- name: Close PR
51-
if: env.result == 'non-member'
52-
uses: actions/github-script@v7
53-
with:
54-
github-token: ${{ secrets.GITHUB_TOKEN }}
55-
script: |
56-
await github.rest.pulls.update({
57-
pull_number: context.issue.number,
58-
owner: context.repo.owner,
59-
repo: context.repo.repo,
60-
state: 'closed'
61-
});
62-
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)