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..f4e1cfa6 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@03a39fd1bad66b91ef5487fd9725437fc1b34e3f # v18.0.8 secrets: inherit diff --git a/.github/workflows/label-sync.yml b/.github/workflows/label-sync.yml index be26ea0e..a513bfbd 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@03a39fd1bad66b91ef5487fd9725437fc1b34e3f # v18.0.8 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..cbd51f06 --- /dev/null +++ b/.github/workflows/pull-request-formatting-validator-post.yml @@ -0,0 +1,41 @@ +# 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@03a39fd1bad66b91ef5487fd9725437fc1b34e3f # v18.0.8 + with: + app-id: $ + head-sha: $ + triggering-run-id: $ + secrets: + private-key: $ diff --git a/.github/workflows/pull-request-formatting-validator.yml b/.github/workflows/pull-request-formatting-validator.yml index 654d1bcc..77a1c6d0 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@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 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..1708dfc6 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@03a39fd1bad66b91ef5487fd9725437fc1b34e3f # v18.0.8 secrets: inherit diff --git a/.github/workflows/scheduled-maintenance.yml b/.github/workflows/scheduled-maintenance.yml index 2f370a4d..72c8a1f4 100644 --- a/.github/workflows/scheduled-maintenance.yml +++ b/.github/workflows/scheduled-maintenance.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Generate Token id: app-token - uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3 with: app-id: ${{ vars.MU_ACCESS_APP_ID }} private-key: ${{ secrets.MU_ACCESS_APP_PRIVATE_KEY }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 929c0986..c62e0398 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@03a39fd1bad66b91ef5487fd9725437fc1b34e3f # v18.0.8 secrets: inherit diff --git a/.github/workflows/triage-issues.yml b/.github/workflows/triage-issues.yml index e2ce1086..df68565a 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@03a39fd1bad66b91ef5487fd9725437fc1b34e3f # v18.0.8 secrets: inherit