Codeowners validation #862
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Codeowners validation' | |
on: | |
push: | |
paths: | |
- 'CODEOWNERS' | |
- 'docs/CODEOWNERS' | |
- '.github/CODEOWNERS' | |
- '.github/workflows/codeowners-validator.yml' | |
branches: | |
- '**' | |
schedule: | |
- cron: '37 4 * * *' # sync-with-template: adjust | |
workflow_dispatch: { } | |
permissions: | |
contents: read | |
jobs: | |
codeowners-validation: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Get repository owner type | |
id: owner-type | |
run: | | |
REPO_JSON=$(curl -s "${{github.api_url}}/repos/${{github.repository}}" -H "Authorization: token ${{github.token}}") | |
OWNER_TYPE=$(echo $REPO_JSON | jq -r '.owner.type') | |
OWNER_TYPE=$(echo "$OWNER_TYPE" | tr '[:upper:]' '[:lower:]') | |
echo "Owner type: $OWNER_TYPE" | |
echo "::set-output name=owner-type::$OWNER_TYPE" | |
- name: Basic CODEOWNERS validation | |
if: ${{steps.owner-type.outputs.owner-type != 'organization'}} | |
uses: mszostok/[email protected] | |
with: | |
github_access_token: '${{secrets.CODEOWNERS_VALIDATOR_TOKEN && secrets.CODEOWNERS_VALIDATOR_TOKEN || github.token}}' | |
checks: 'syntax,duppatterns,files' | |
- name: Full CODEOWNERS validation | |
if: ${{steps.owner-type.outputs.owner-type == 'organization'}} | |
uses: mszostok/[email protected] | |
with: | |
github_access_token: '${{secrets.CODEOWNERS_VALIDATOR_TOKEN && secrets.CODEOWNERS_VALIDATOR_TOKEN || github.token}}' |