Skip to content

Commit a50cb30

Browse files
authored
Split approval and merge workflows (#76)
Split approval and merge workflows Splitting the workflows provides several benefits: 1. Simplifies logic due to jobs being attached to separate triggers relevant for the specific job. 2. Reduces number of status checks shown in PRs due to certain steps being skipped in irrelevant circumstances. 3. Allows better workflow reuse. The reviewers are also dropped from dependabot PRs since the pending team reviewer is (1) not acted upon (2) can delay PR merging if the reviewer team has not reviewed the PR. The version is updated in anticipation of this change. It will be modified if the expected version changes before this PR is merged. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
1 parent d6bbd0b commit a50cb30

File tree

7 files changed

+67
-47
lines changed

7 files changed

+67
-47
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ updates:
3232
prefix: "GitHub Action"
3333
labels:
3434
- "type:dependencies"
35-
reviewers:
36-
- "microsoft/project-mu-dependency-reviewers"
3735

3836
- package-ecosystem: "pip"
3937
directory: "/"
@@ -44,5 +42,3 @@ updates:
4442
labels:
4543
- "language:python"
4644
- "type:dependencies"
47-
reviewers:
48-
- "microsoft/project-mu-dependency-reviewers"

.github/workflows/AutoApprover.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow automatically approves pull requests under certain
2+
# conditions in Project Mu repos.
3+
#
4+
# Copyright (c) Microsoft Corporation.
5+
# SPDX-License-Identifier: BSD-2-Clause-Patent
6+
#
7+
# For more information, see:
8+
# https://github.com/pascalgn/automerge-action
9+
10+
name: Auto Approve Pull Request Workflow
11+
12+
on:
13+
workflow_call:
14+
15+
jobs:
16+
bot_approval:
17+
name: Bot Approval
18+
runs-on: ubuntu-latest
19+
permissions:
20+
pull-requests: write
21+
22+
steps:
23+
- uses: hmarr/auto-approve-action@v3
24+
with:
25+
github-token: ${{ secrets.GITHUB_TOKEN }}
26+
review-message: "🤖 auto approved a ${{ github.event.pull_request.user.login }} PR."
27+
28+
- uses: hmarr/auto-approve-action@v3
29+
with:
30+
github-token: ${{ secrets.PROJECT_MU_BOT_TOKEN }}
31+
review-message: "🤖 auto approved a ${{ github.event.pull_request.user.login }} PR."

.github/workflows/AutoMerger.yml

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,7 @@ on:
1313
workflow_call:
1414

1515
jobs:
16-
bot_approval:
17-
name: Bot Approval
18-
if: |
19-
github.event_name == 'pull_request_target' &&
20-
(github.event.action == 'opened' || github.event.action == 'reopened') &&
21-
(github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'uefibot')
22-
runs-on: ubuntu-latest
23-
permissions:
24-
pull-requests: write
25-
26-
steps:
27-
- uses: hmarr/auto-approve-action@v3
28-
with:
29-
github-token: ${{ secrets.GITHUB_TOKEN }}
30-
review-message: "🤖 auto approved a ${{ github.event.pull_request.user.login }} PR."
31-
32-
- uses: hmarr/auto-approve-action@v3
33-
with:
34-
github-token: ${{ secrets.PROJECT_MU_BOT_TOKEN }}
35-
review-message: "🤖 auto approved a ${{ github.event.pull_request.user.login }} PR."
36-
37-
auto_merge:
16+
bot_merge:
3817
name: Merge
3918
runs-on: ubuntu-latest
4019

@@ -56,9 +35,8 @@ jobs:
5635
MERGE_LABELS: "!state:duplicate,!state:invalid,!state:needs-maintainer-feedback,!state:needs-submitter-info,!state:under-discussion,!state:wont-fix,!type:notes,!type:question"
5736
MERGE_METHOD: "squash" # Default merge method squash (instead of "merge")
5837
MERGE_REMOVE_LABELS: = "" # Do not remove any labels from a PR after merge
59-
MERGE_REQUIRED_APPROVALS: "2" # Two PRs can be humans or bots (need to pass PR gates)
60-
MERGE_RETRIES: "6" # Check if PR status checks pass up to 6 times
61-
MERGE_RETRY_SLEEP: "10000" # Check if PR status checks are met every 10 secs (6 * 10 = check over 1 min)
38+
MERGE_RETRIES: "120" # Check if PR status checks pass up to 120 times
39+
MERGE_RETRY_SLEEP: "60000" # Check if PR status checks are met every 60 secs (60 * 120 = check over 2 hrs)
6240
UPDATE_LABELS: "" # Always update these PRs if needed to merge
6341
UPDATE_METHOD: "rebase" # Default PR update method rebase (instead of "merge")
6442
UPDATE_RETRIES: "2" # Check if an update is needed up to 2 times

.github/workflows/FileSyncer.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,3 @@ jobs:
4646
🤖: View the [Repo File Sync Configuration File](https://github.com/microsoft/mu_devops/blob/main/.sync/Files.yml) to see how files are synced.
4747
PR_LABELS: type:file-sync
4848
SKIP_PR: false
49-
TEAM_REVIEWERS: microsoft/project-mu-dependency-reviewers

.sync/Version.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#}
3131

3232
{# The git ref value that files dependent on this repo will use. #}
33-
{% set mu_devops = "v1.4.0" %}
33+
{% set mu_devops = "v1.4.2" %}
3434

3535
{# The version of the fedora-35-build container to use. #}
3636
{% set linux_build_container = "ghcr.io/tianocore/containers/fedora-35-build:2113a0e" %}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow automatically approves pull requests under certain conditions.
2+
#
3+
# NOTE: This file is automatically synchronized from Mu DevOps. Update the original file there
4+
# instead of the file in this repo.
5+
#
6+
# NOTE: This file uses a reusable workflow. Do not make changes to the file that should be made
7+
# in the common/reusable workflow.
8+
#
9+
# - Mu DevOps Repo: https://github.com/microsoft/mu_devops
10+
# - File Sync Settings: https://github.com/microsoft/mu_devops/blob/main/.sync/Files.yml
11+
#
12+
# Copyright (c) Microsoft Corporation.
13+
# SPDX-License-Identifier: BSD-2-Clause-Patent
14+
#
15+
16+
{% import '../../Version.njk' as sync_version -%}
17+
18+
name: Auto Approve Pull Request
19+
20+
on:
21+
pull_request_target:
22+
types:
23+
- opened
24+
- reopened
25+
26+
jobs:
27+
approval_check:
28+
if: |
29+
github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'uefibot'
30+
uses: microsoft/mu_devops/.github/workflows/AutoApprover.yml@{{ sync_version.mu_devops }}
31+
secrets: inherit

.sync/workflows/leaf/auto-merge.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,13 @@ name: Auto Merge Pull Request
2020
on:
2121
pull_request_target:
2222
types:
23-
- edited
24-
- labeled
2523
- opened
26-
- ready_for_review
2724
- reopened
2825
- synchronize
29-
- unlabeled
30-
- unlocked
31-
pull_request_review:
32-
types:
33-
- submitted
34-
check_suite:
35-
types:
36-
- completed
37-
status: {}
3826

3927
jobs:
4028
merge_check:
4129
if: |
42-
((github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') &&
43-
(github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'uefibot')) ||
44-
((github.event_name == 'check_suite') &&
45-
(github.event.check_suite.sender.login == 'dependabot[bot]' || github.event.check_suite.sender.login == 'uefibot'))
30+
github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'uefibot'
4631
uses: microsoft/mu_devops/.github/workflows/AutoMerger.yml@{{ sync_version.mu_devops }}
4732
secrets: inherit

0 commit comments

Comments
 (0)