Skip to content

Sync with edk2 oct 2023 v2 #43

Sync with edk2 oct 2023 v2

Sync with edk2 oct 2023 v2 #43

## @file
# Check CODEOWNERS, REVIEWERS, and Maintainers.txt files.
#
# Only run this check if any of the files modified in the PR
# are CODEOWNERS, REVIEWERS, or Maintainers.txt.
#
# This workflow uses pull_request_target to support passing in
# github_access_token that is not available for pull_request.
# The checkout action checks out the head of the PR. In this
# specific workflow, this is safe because there are no dependencies
# on any files other that this .yml file and known external actions.
#
# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
name: Check CODEOWNERS, REVIEWERS, and Maintainers.txt files
on:
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- 'master'
paths:
- 'CODEOWNERS'
- 'docs/CODEOWNERS'
- '.github/CODEOWNERS'
- 'REVIEWERS'
- 'docs/REVIEWERS'
- '.github/REVIEWERS'
- 'Maintainers.txt'
jobs:
check_codeowners_maintainers:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout Pull Request
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check CODEOWNERS, REVIEWERS, and Maintainers.txt files
uses: mdkinney/github-action-check-codeowners-maintainers@main
with:
token: ${{secrets.GITHUB_TOKEN}}
codeowners_validator_user:
if: github.event.pull_request.draft == false && github.event.pull_request.base.user.type == 'User'
runs-on: ubuntu-latest
steps:
- name: Checkout Pull Request
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: CODEOWNERS Validator
uses: mszostok/[email protected]
with:
checks: "files,duppatterns,syntax"
experimental_checks: "notowned,avoid-shadowing"
github_access_token: "${{ secrets.GITHUB_TOKEN }}"
codeowners_validator_organization:
if: github.event.pull_request.draft == false && github.event.pull_request.base.user.type == 'Organization'
runs-on: ubuntu-latest
steps:
- name: Checkout Pull Request
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: CODEOWNERS Validator
uses: mszostok/[email protected]
with:
checks: "files,owners,duppatterns,syntax"
experimental_checks: "notowned,avoid-shadowing"
github_access_token: "${{ secrets.CODEOWNERS_VALIDATOR_TOKEN }}"
reviewers_validator_user:
if: github.event.pull_request.draft == false && github.event.pull_request.base.user.type == 'User'
runs-on: ubuntu-latest
steps:
- name: Checkout Pull Request
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Copy REVIEWERS to CODEOWNERS
run: |
[[ -e CODEOWNERS ]] && rm CODEOWNERS
[[ -e docs/CODEOWNERS ]] && rm docs/CODEOWNERS
[[ -e .github/CODEOWNERS ]] && rm .github/CODEOWNERS
[[ -e REVIEWERS ]] && cp REVIEWERS CODEOWNERS
[[ -e docs/REVIEWERS ]] && cp docs/REVIEWERS docs/CODEOWNERS
[[ -e .github/REVIEWERS ]] && cp .github/REVIEWERS .github/CODEOWNERS
- name: REVIEWERS Validator
uses: mszostok/[email protected]
with:
checks: "files,duppatterns,syntax"
experimental_checks: "avoid-shadowing"
github_access_token: "${{ secrets.GITHUB_TOKEN }}"
reviewers_validator_organization:
if: github.event.pull_request.draft == false && github.event.pull_request.base.user.type == 'Organization'
runs-on: ubuntu-latest
steps:
- name: Checkout Pull Request
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Copy REVIEWERS to CODEOWNERS
run: |
[[ -e CODEOWNERS ]] && rm CODEOWNERS
[[ -e docs/CODEOWNERS ]] && rm docs/CODEOWNERS
[[ -e .github/CODEOWNERS ]] && rm .github/CODEOWNERS
[[ -e REVIEWERS ]] && cp REVIEWERS CODEOWNERS
[[ -e docs/REVIEWERS ]] && cp docs/REVIEWERS docs/CODEOWNERS
[[ -e .github/REVIEWERS ]] && cp .github/REVIEWERS .github/CODEOWNERS
- name: REVIEWERS Validator
uses: mszostok/[email protected]
with:
checks: "files,owners,duppatterns,syntax"
experimental_checks: "avoid-shadowing"
github_access_token: "${{ secrets.CODEOWNERS_VALIDATOR_TOKEN }}"