External contributor auto-draft and dispatch pr-review event type (#20329)
# Introduction ## Auto draft On external contributor PR creation auto draft it and comment stating that it needs to be marked as ready for review when it is ## Caveats / future improvement Lets iterate first but we can imagine future pain points such as: - Cubic only runs on ready for review PRs - Expected green ci before turning ready to be review ? ( we could invoke cubic ourselves )\ - Auto close external contributors draft PR after x duration ## Auto review Once a PR started to be review or is being synchronized then auto dispatch auto review
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
name: Auto-Draft External PRs
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
convert-to-draft:
|
||||
if: |
|
||||
github.event.pull_request.draft == false &&
|
||||
github.event.pull_request.author_association != 'MEMBER' &&
|
||||
github.event.pull_request.author_association != 'OWNER' &&
|
||||
github.event.pull_request.author_association != 'COLLABORATOR'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Convert to draft
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PR_NODE_ID: ${{ github.event.pull_request.node_id }}
|
||||
run: |
|
||||
gh api graphql -f query="
|
||||
mutation {
|
||||
convertPullRequestToDraft(input: {pullRequestId: \"$PR_NODE_ID\"}) {
|
||||
pullRequest { isDraft }
|
||||
}
|
||||
}
|
||||
"
|
||||
|
||||
- name: Welcome comment
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
gh pr comment "$PR_NUMBER" --repo ${{ github.repository }} --body "👋 Thanks for contributing to Twenty!
|
||||
|
||||
Your PR has been set to draft while you work on it. Once you're done, mark it as **Ready for review** and our automated checks will run.
|
||||
|
||||
Looking forward to your contribution!"
|
||||
Reference in New Issue
Block a user