From 65d4fc75dd0441134a0aabc368eb5b53ddbba075 Mon Sep 17 00:00:00 2001 From: "mu-automation[bot]" <204385837+mu-automation[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 15:30:34 +0000 Subject: [PATCH] Repo File Sync: synced file(s) with microsoft/mu_devops Signed-off-by: Project Mu UEFI Bot --- .github/workflows/issue-assignment.yml | 2 +- .github/workflows/label-sync.yml | 2 +- .../pull-request-formatting-validator.yml | 74 +++++++++++++++++++ .github/workflows/release-draft.yml | 2 +- .github/workflows/stale.yml | 2 +- .github/workflows/triage-issues.yml | 2 +- 6 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/pull-request-formatting-validator.yml diff --git a/.github/workflows/issue-assignment.yml b/.github/workflows/issue-assignment.yml index 32e3787..0dab505 100644 --- a/.github/workflows/issue-assignment.yml +++ b/.github/workflows/issue-assignment.yml @@ -19,5 +19,5 @@ on: jobs: apply: - uses: microsoft/mu_devops/.github/workflows/IssueAssignment.yml@v18.0.4 + uses: microsoft/mu_devops/.github/workflows/IssueAssignment.yml@v18.0.5 secrets: inherit diff --git a/.github/workflows/label-sync.yml b/.github/workflows/label-sync.yml index bc05dc9..c2fa6f8 100644 --- a/.github/workflows/label-sync.yml +++ b/.github/workflows/label-sync.yml @@ -25,5 +25,5 @@ on: jobs: sync: - uses: microsoft/mu_devops/.github/workflows/LabelSyncer.yml@v18.0.4 + uses: microsoft/mu_devops/.github/workflows/LabelSyncer.yml@v18.0.5 secrets: inherit diff --git a/.github/workflows/pull-request-formatting-validator.yml b/.github/workflows/pull-request-formatting-validator.yml new file mode 100644 index 0000000..8510e6b --- /dev/null +++ b/.github/workflows/pull-request-formatting-validator.yml @@ -0,0 +1,74 @@ +# This workflow validates basic pull request formatting requirements are met. +# +# NOTE: This file is automatically synchronized from Mu DevOps. Update the original file there +# instead of the file in this repo. +# +# - Mu DevOps Repo: https://github.com/microsoft/mu_devops +# - File Sync Settings: https://github.com/microsoft/mu_devops/blob/main/.sync/Files.yml +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# + +name: Validate Pull Request Formatting + +on: + pull_request_target: + types: + - edited + - opened + - reopened + - synchronize + +jobs: + validate_pr: + runs-on: ubuntu-latest + + steps: + - name: Generate Token + id: app-token + uses: actions/create-github-app-token@v3 + with: + app-id: ${{ vars.MU_ACCESS_APP_ID }} + private-key: ${{ secrets.MU_ACCESS_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + + - run: | + prTitle="$(gh api graphql -F owner=$OWNER -F name=$REPO -F pr_number=$PR_NUMBER -f query=' + query($name: String!, $owner: String!, $pr_number: Int!) { + repository(owner: $owner, name: $name) { + pullRequest(number: $pr_number) { + title + } + } + }' --jq '.data.repository.pullRequest.title')" + + comments="$(gh api "repos/${OWNER}/${REPO}/issues/${PR_NUMBER}/comments" --paginate --jq '.[].body')" + + if [[ "${prTitle}" == *"Personal/"* ]]; then + if ! echo "${comments}" | grep -qF ''; then + gh pr comment $PR_URL --body "⚠️ Please add a meaningful PR title (remove the 'Personal/' prefix from the title)." + fi + echo 'VALIDATION_ERROR=true' >> $GITHUB_ENV + fi + + if [[ "${prTitle}" == "Repo File Sync: synced file(s) with microsoft/mu_devops" ]]; then + if ! echo "${comments}" | grep -qF ''; then + gh pr comment $PR_URL --body "⚠️ Please add a meaningful PR title (update the default file sync title)." + fi + echo 'VALIDATION_ERROR=true' >> $GITHUB_ENV + fi + + env: + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} + OWNER: ${{ github.repository_owner }} + PR_NUMBER: ${{ github.event.number }} + PR_URL: ${{ github.event.pull_request.html_url }} + REPO: ${{ github.event.repository.name }} + + - name: Check for Validation Errors + if: env.VALIDATION_ERROR + uses: actions/github-script@v8 + with: + script: | + core.setFailed('PR Formatting Validation Check Failed!') diff --git a/.github/workflows/release-draft.yml b/.github/workflows/release-draft.yml index ad62938..e815f92 100644 --- a/.github/workflows/release-draft.yml +++ b/.github/workflows/release-draft.yml @@ -29,5 +29,5 @@ jobs: draft: name: Draft Releases - uses: microsoft/mu_devops/.github/workflows/ReleaseDrafter.yml@v18.0.4 + uses: microsoft/mu_devops/.github/workflows/ReleaseDrafter.yml@v18.0.5 secrets: inherit diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index bfd5014..568dc15 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -25,5 +25,5 @@ on: jobs: check: - uses: microsoft/mu_devops/.github/workflows/Stale.yml@v18.0.4 + uses: microsoft/mu_devops/.github/workflows/Stale.yml@v18.0.5 secrets: inherit diff --git a/.github/workflows/triage-issues.yml b/.github/workflows/triage-issues.yml index c11f64a..8836031 100644 --- a/.github/workflows/triage-issues.yml +++ b/.github/workflows/triage-issues.yml @@ -20,5 +20,5 @@ on: jobs: triage: - uses: microsoft/mu_devops/.github/workflows/IssueTriager.yml@v18.0.4 + uses: microsoft/mu_devops/.github/workflows/IssueTriager.yml@v18.0.5 secrets: inherit