mirror of https://github.com/dapr/java-sdk.git
Does not rely on MAINTAINERS env for merging with auto-merge (#1224)
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
This commit is contained in:
parent
510679e295
commit
59abd5dbcc
|
@ -18,14 +18,13 @@ from github import Github
|
||||||
|
|
||||||
g = Github(os.getenv("GITHUB_TOKEN"))
|
g = Github(os.getenv("GITHUB_TOKEN"))
|
||||||
repo = g.get_repo(os.getenv("GITHUB_REPOSITORY"))
|
repo = g.get_repo(os.getenv("GITHUB_REPOSITORY"))
|
||||||
maintainers = [m.strip() for m in os.getenv("MAINTAINERS").split(',')]
|
|
||||||
|
|
||||||
def fetch_pulls(mergeable_state):
|
def fetch_pulls(mergeable_state):
|
||||||
return [pr for pr in repo.get_pulls(state='open', sort='created') \
|
return [pr for pr in repo.get_pulls(state='open', sort='created') \
|
||||||
if pr.mergeable_state == mergeable_state and 'auto-merge' in [l.name for l in pr.labels]]
|
if pr.mergeable_state == mergeable_state and 'auto-merge' in [l.name for l in pr.labels]]
|
||||||
|
|
||||||
def is_approved(pr):
|
def is_approved(pr):
|
||||||
approvers = [r.user.login for r in pr.get_reviews() if r.state == 'APPROVED' and r.user.login in maintainers]
|
approvers = [r.user.login for r in pr.get_reviews() if r.state == 'APPROVED']
|
||||||
return len([a for a in approvers if repo.get_collaborator_permission(a) in ['admin', 'write']]) > 0
|
return len([a for a in approvers if repo.get_collaborator_permission(a) in ['admin', 'write']]) > 0
|
||||||
|
|
||||||
# First, find a PR that can be merged
|
# First, find a PR that can be merged
|
||||||
|
|
|
@ -27,6 +27,5 @@ jobs:
|
||||||
run: pip install PyGithub
|
run: pip install PyGithub
|
||||||
- name: Automerge and update
|
- name: Automerge and update
|
||||||
env:
|
env:
|
||||||
MAINTAINERS: artursouza,mukundansundar
|
|
||||||
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
|
||||||
run: python ./.github/scripts/automerge.py
|
run: python ./.github/scripts/automerge.py
|
||||||
|
|
Loading…
Reference in New Issue