forked from tianocore/edk2
-
Notifications
You must be signed in to change notification settings - Fork 4
56 lines (52 loc) · 2.12 KB
/
patchcheck.yml
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
## @file
# Run PatchCheck on all commits in a pull request
#
# Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
name: PatchCheck
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
branches:
- CiEnabled
env:
RunPatchCheck: True
PatchCheckOptions: ''
jobs:
patchcheck:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: IsLabel
if: ${{ contains(fromJSON('["labeled", "unlabeled"]'), github.event.action) && (github.event.label.name != 'ignore-multi-package') }}
run: echo "RunPatchCheck=False" >> $GITHUB_ENV
- name: IsIgnoreMultiPackage
if: ${{ env.RunPatchCheck == 'True' && contains(github.event.pull_request.labels.*.name, 'ignore-multi-package')}}
run: echo "PatchCheckOptions=--ignore-multi-package" >> $GITHUB_ENV
- name: Install Python
if: ${{ env.RunPatchCheck == 'True' }}
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Fetch Depth
if: ${{ env.RunPatchCheck == 'True' }}
run: echo "FetchDepth=$((${{ github.event.pull_request.commits }} + 1))" >> $GITHUB_ENV
- name: Fetch PR
if: ${{ env.RunPatchCheck == 'True' }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: ${{ env.FetchDepth }}
sparse-checkout: |
pip-requirements.txt
BaseTools/Scripts/PatchCheck.py
- name: Checkout Base
if: ${{ env.RunPatchCheck == 'True' }}
run: git checkout ${{ github.event.pull_request.base.sha }}
- name: Install Python Dependencies
if: ${{ env.RunPatchCheck == 'True' }}
run: pip install -r pip-requirements.txt
- name: PatchCheck
if: ${{ env.RunPatchCheck == 'True' }}
run: python BaseTools/Scripts/PatchCheck.py ${{ env.PatchCheckOptions }} ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }}..