From fc0c1926db61b0a6a89a5ea79e3038020920ffab Mon Sep 17 00:00:00 2001 From: "mu-automation[bot]" <204385837+mu-automation[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2026 23:31:58 +0000 Subject: [PATCH] Repo File Sync: synced file(s) with microsoft/mu_devops Signed-off-by: Project Mu UEFI Bot --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- .github/workflows/issue-assignment.yml | 2 +- .github/workflows/label-sync.yml | 2 +- ...pull-request-formatting-validator-post.yml | 42 ++++++++++ .../pull-request-formatting-validator.yml | 82 ++++++++++--------- .github/workflows/release-draft.yml | 2 +- .github/workflows/stale.yml | 2 +- .github/workflows/triage-issues.yml | 2 +- 8 files changed, 90 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/pull-request-formatting-validator-post.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 9b8fc311..5bed21d7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -67,7 +67,7 @@ body: description: | examples: - **OS**: Ubuntu 20.04 or Windows 11... - - **Tool Chain**: GCC5 or VS2022 or CLANGPDB... + - **Tool Chain**: GCC or VS2022 or CLANGPDB... - **Targets Impacted**: RELEASE, DEBUG, NO-TARGET, NOOPT... value: | - OS(s): diff --git a/.github/workflows/issue-assignment.yml b/.github/workflows/issue-assignment.yml index 8ca99ac1..aaa826a8 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@131433bb4f29d68250154cc66096f04c19fe3ee9 # v18.0.7 + uses: microsoft/mu_devops/.github/workflows/IssueAssignment.yml@9720bedf20a0e78a93b79f9d43a7bbfc2be38a62 # v18.0.10 secrets: inherit diff --git a/.github/workflows/label-sync.yml b/.github/workflows/label-sync.yml index be26ea0e..e243c68a 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@131433bb4f29d68250154cc66096f04c19fe3ee9 # v18.0.7 + uses: microsoft/mu_devops/.github/workflows/LabelSyncer.yml@9720bedf20a0e78a93b79f9d43a7bbfc2be38a62 # v18.0.10 secrets: inherit diff --git a/.github/workflows/pull-request-formatting-validator-post.yml b/.github/workflows/pull-request-formatting-validator-post.yml new file mode 100644 index 00000000..12ea19d7 --- /dev/null +++ b/.github/workflows/pull-request-formatting-validator-post.yml @@ -0,0 +1,42 @@ +# This workflow posts pull request formatting comments after the "Validate Pull Request Formatting" +# workflow completes. It runs from the default branch with access to secrets, which the pull_request +# workflow does not have. +# +# NOTE: This file is automatically synchronized from Mu DevOps. Update the original file there +# instead of the file in this repo. +# +# NOTE: This file uses a reusable workflow. Do not make changes to the file that should be made +# in the common/reusable workflow. +# +# - 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 Post + +on: + workflow_run: + workflows: ["Validate Pull Request Formatting"] + types: ["completed"] + +permissions: + contents: read + actions: read + +jobs: + post_comments: + # The metadata artifact is only uploaded when the title check fails. + if: | + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'failure' + uses: microsoft/mu_devops/.github/workflows/PullRequestFormattingValidatorPost.yml@9720bedf20a0e78a93b79f9d43a7bbfc2be38a62 # v18.0.10 + with: + app-id: ${{ vars.MU_ACCESS_APP_ID }} + head-sha: ${{ github.event.workflow_run.head_sha }} + triggering-run-id: ${{ github.event.workflow_run.id }} + secrets: + private-key: ${{ secrets.MU_ACCESS_APP_PRIVATE_KEY }} + diff --git a/.github/workflows/pull-request-formatting-validator.yml b/.github/workflows/pull-request-formatting-validator.yml index a8b25bc0..f50483a9 100644 --- a/.github/workflows/pull-request-formatting-validator.yml +++ b/.github/workflows/pull-request-formatting-validator.yml @@ -1,5 +1,8 @@ # This workflow validates basic pull request formatting requirements are met. # +# The title check runs without secrets. When it fails, the pull request number is uploaded so the +# "Validate Pull Request Formatting Post" workflow can post a comment. +# # NOTE: This file is automatically synchronized from Mu DevOps. Update the original file there # instead of the file in this repo. # @@ -13,62 +16,61 @@ name: Validate Pull Request Formatting on: - pull_request_target: + pull_request: types: - edited - opened - reopened - synchronize +permissions: + contents: read + jobs: validate_pr: runs-on: ubuntu-latest steps: - - name: Generate Token - id: app-token - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 - 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')" + - name: Validate Pull Request Title + id: validate + env: + PR_NUMBER: ${{ github.event.pull_request.number }} + PR_TITLE: ${{ github.event.pull_request.title }} + run: | + personal_prefix=false + default_sync_title=false - comments="$(gh api "repos/${OWNER}/${REPO}/issues/${PR_NUMBER}/comments" --paginate --jq '.[].body')" + if [[ "${PR_TITLE,,}" == *"personal/"* ]]; then + echo "::error::Please add a meaningful PR title (remove the 'Personal/' prefix from the title)." + personal_prefix=true + fi - 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 + if [[ "${PR_TITLE}" == "Repo File Sync: synced file(s) with microsoft/mu_devops" ]]; then + echo "::error::Please add a meaningful PR title (update the default file sync title)." + default_sync_title=true 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 + violation=false + if [[ "${personal_prefix}" == "true" || "${default_sync_title}" == "true" ]]; then + violation=true + mkdir metadata + printf '{"pr_number": %s, "personal_prefix": %s, "default_sync_title": %s}\n' \ + "${PR_NUMBER}" "${personal_prefix}" "${default_sync_title}" > metadata/pr-metadata.json 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 }} + echo "violation=${violation}" >> "$GITHUB_OUTPUT" - - name: Check for Validation Errors - if: env.VALIDATION_ERROR - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + - name: Upload PR Metadata + if: steps.validate.outputs.violation == 'true' + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: - script: | - core.setFailed('PR Formatting Validation Check Failed!') + name: pr-formatting-metadata + path: metadata/pr-metadata.json + overwrite: true + retention-days: 5 + + - name: Check for Validation Errors + if: steps.validate.outputs.violation == 'true' + run: | + echo "::error::PR Formatting Validation Check Failed!" + exit 1 diff --git a/.github/workflows/release-draft.yml b/.github/workflows/release-draft.yml index a43ba02b..c84b9b8e 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@131433bb4f29d68250154cc66096f04c19fe3ee9 # v18.0.7 + uses: microsoft/mu_devops/.github/workflows/ReleaseDrafter.yml@9720bedf20a0e78a93b79f9d43a7bbfc2be38a62 # v18.0.10 secrets: inherit diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 929c0986..c9203d73 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@131433bb4f29d68250154cc66096f04c19fe3ee9 # v18.0.7 + uses: microsoft/mu_devops/.github/workflows/Stale.yml@9720bedf20a0e78a93b79f9d43a7bbfc2be38a62 # v18.0.10 secrets: inherit diff --git a/.github/workflows/triage-issues.yml b/.github/workflows/triage-issues.yml index e2ce1086..9e178d3a 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@131433bb4f29d68250154cc66096f04c19fe3ee9 # v18.0.7 + uses: microsoft/mu_devops/.github/workflows/IssueTriager.yml@9720bedf20a0e78a93b79f9d43a7bbfc2be38a62 # v18.0.10 secrets: inherit