Skip to content

Commit

Permalink
Does not rely on MAINTAINERS env for merging with auto-merge (#1224)
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
  • Loading branch information
artursouza authored Mar 1, 2025
1 parent 510679e commit 59abd5d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
3 changes: 1 addition & 2 deletions .github/scripts/automerge.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@

g = Github(os.getenv("GITHUB_TOKEN"))
repo = g.get_repo(os.getenv("GITHUB_REPOSITORY"))
maintainers = [m.strip() for m in os.getenv("MAINTAINERS").split(',')]

def fetch_pulls(mergeable_state):
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]]

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

# First, find a PR that can be merged
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/automerge-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ jobs:
run: pip install PyGithub
- name: Automerge and update
env:
MAINTAINERS: artursouza,mukundansundar
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
run: python ./.github/scripts/automerge.py

0 comments on commit 59abd5d

Please sign in to comment.