Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add auto approval for auto merge #68

Merged
merged 3 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions .github/workflows/AutoMerger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ on:
workflow_call:

jobs:
bot_approval:
name: Bot Approval
if: |
github.event_name == 'pull_request_target' &&
(github.event.action == 'opened' || github.event.action == 'reopened') &&
(github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'uefibot')
runs-on: ubuntu-latest
permissions:
pull-requests: write

steps:
- uses: hmarr/auto-approve-action@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
review-message: "🤖 auto approved a ${{ github.event.pull_request.user.login }} PR."

- uses: hmarr/auto-approve-action@v3
with:
github-token: ${{ secrets.PROJECT_MU_BOT_TOKEN }}
review-message: "🤖 auto approved a ${{ github.event.pull_request.user.login }} PR."

auto_merge:
name: Merge
runs-on: ubuntu-latest
Expand All @@ -28,13 +49,14 @@ jobs:
id: auto_merge
uses: pascalgn/automerge-action@v0.15.5
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_TOKEN: "${{ secrets.PROJECT_MU_BOT_TOKEN }}"
MERGE_ERROR_FAIL: "false" # Do not fail if an auto merge couldn't happen
MERGE_FILTER_AUTHOR: "${{ matrix.author }}"
MERGE_FORKS: "false" # dependabot and uefibot come from local repo branches - forks not needed
MERGE_LABELS: "!state:duplicate,!state:invalid,!state:needs-maintainer-feedback,!state:needs-submitter-info,!state:under-discussion,!state:wont-fix,!type:notes,!type:question"
MERGE_METHOD: "squash" # Default merge method squash (instead of "merge")
MERGE_REMOVE_LABELS: = "" # Do not remove any labels from a PR after merge
MERGE_REQUIRED_APPROVALS: "0" # Auto merge these PRs without human reviewers involved (need to pass PR gates)
MERGE_REQUIRED_APPROVALS: "2" # Two PRs can be humans or bots (need to pass PR gates)
MERGE_RETRIES: "6" # Check if PR status checks pass up to 6 times
MERGE_RETRY_SLEEP: "10000" # Check if PR status checks are met every 10 secs (6 * 10 = check over 1 min)
UPDATE_LABELS: "" # Always update these PRs if needed to merge
Expand Down
6 changes: 6 additions & 0 deletions .sync/workflows/leaf/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@ on:

jobs:
merge_check:
if: |
((github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') &&
(github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'uefibot')) ||
((github.event_name == 'check_suite') &&
(github.event.check_suite.sender.login == 'dependabot[bot]' || github.event.check_suite.sender.login == 'uefibot'))
uses: microsoft/mu_devops/.github/workflows/AutoMerger.yml@{{ sync_version.mu_devops }}
secrets: inherit