File: pull-request-formatting-validator.yml

package info (click to toggle)
edk2 2025.11-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 338,556 kB
  • sloc: ansic: 2,166,376; asm: 270,725; perl: 235,301; python: 149,839; sh: 34,744; cpp: 23,311; makefile: 3,326; pascal: 1,602; xml: 806; lisp: 35; ruby: 16; sed: 6; tcl: 4
file content (77 lines) | stat: -rw-r--r-- 2,469 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# This workflow validates basic pull request formatting requirements are met.
#
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: BSD-2-Clause-Patent
#

name: Validate Pull Request Formatting

on:
  pull_request_target:
    branches:
      - master
    types:
      - edited
      - opened
      - reopened
      - synchronize

concurrency:
  group: pr-validation-${{ github.event.number }}
  cancel-in-progress: true

jobs:
  validate_pr:
    name: Validate Pull Request Formatting
    # Do not run on draft PRs and only run on PRs in the tianocore org
    if: ${{ github.event.pull_request.draft == false && github.repository_owner == 'tianocore' }}
    runs-on: ubuntu-latest

    steps:
      - name: Generate Token
        id: app-token
        uses: actions/create-github-app-token@v2
        with:
          app-id: ${{ secrets.TIANOCORE_PR_AUTOMATION_APPLICATION_ID }}
          private-key: ${{ secrets.TIANOCORE_PR_AUTOMATION_APPLICATION_PRIVATE_KEY }}

      # Reduce checkout time with sparse-checkout
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 1
          sparse-checkout: |
            .github/scripts/

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.x'
          cache: 'pip'
          cache-dependency-path: '.github/scripts/requirements.txt'

      - name: Install PIP Modules
        run: pip install -r .github/scripts/requirements.txt

      - name: Validate PR Format
        id: validate
        run: python .github/scripts/validate_pr_formatting.py
        env:
          GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
          OWNER: ${{ github.repository_owner }}
          PR_NUMBER: ${{ github.event.number }}
          REPO: ${{ github.event.pull_request.base.repo.name }}

      - name: Post Validation Comment
        if: steps.validate.outputs.validation_error == 'true'
        run: python .github/scripts/validate_pr_formatting.py --post-comment
        env:
          GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
          PR_NUMBER: ${{ github.event.number }}

      - name: Check for Validation Errors
        if: steps.validate.outputs.validation_error == 'true'
        uses: actions/github-script@v7
        with:
          script: |
            core.setFailed('PR Formatting Validation Check Failed!')