mirror of
https://github.com/appwrite/sdk-for-flutter.git
synced 2026-06-06 19:37:52 +00:00
Update autoclose.yml
This commit is contained in:
@@ -6,56 +6,6 @@ on:
|
||||
|
||||
jobs:
|
||||
auto_close:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check if user is organization member
|
||||
id: check-membership
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }}
|
||||
script: |
|
||||
const org = 'Appwrite';
|
||||
let isMember = 'non-member';
|
||||
try {
|
||||
await github.rest.orgs.checkMembershipForUser({
|
||||
org: org,
|
||||
username: context.payload.pull_request.user.login
|
||||
});
|
||||
console.log('PR author is a core member. Keeping PR open.');
|
||||
isMember = 'member';
|
||||
} catch (error) {
|
||||
console.log('PR author is not a core member.');
|
||||
}
|
||||
return isMember;
|
||||
result-encoding: string
|
||||
|
||||
- name: Set member output
|
||||
id: set-output
|
||||
run: echo "result=${{ steps.check-membership.outputs.result }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Comment on PR
|
||||
if: env.result == 'non-member'
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
await github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
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.'
|
||||
});
|
||||
console.log('Comment added to PR.');
|
||||
- name: Close PR
|
||||
if: env.result == 'non-member'
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
await github.rest.pulls.update({
|
||||
pull_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
state: 'closed'
|
||||
});
|
||||
console.log('PR closed.');
|
||||
uses: appwrite/.github/.github/workflows/autoclose.yml@main
|
||||
secrets:
|
||||
GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user