forked from tianocore/edk2
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathpull-request-formatting-validator.yml
More file actions
77 lines (66 loc) · 2.41 KB
/
pull-request-formatting-validator.yml
File metadata and controls
77 lines (66 loc) · 2.41 KB
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!')