Skip to content

Improve OpenWebUI instructions #171

Improve OpenWebUI instructions

Improve OpenWebUI instructions #171

# Copyright Advanced Micro Devices, Inc.
#
# SPDX-License-Identifier: MIT
name: Check Copyright Notice
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
check-copyright:
name: Copyright Notice Validation
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Get changed files and check contributor
id: changed-files
run: |
# Get list of changed files in this PR
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }})
echo "changed_files<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGED_FILES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# Check if PR author is AMD employee
AUTHOR_EMAIL="${{ github.event.pull_request.user.login }}"
# Check if author works for AMD by looking at commit email domains
AMD_COMMITS=$(git log --format="%ae" ${{ github.event.pull_request.base.sha }}..${{ github.sha }} | grep -c "@amd.com" || echo "0")
ALL_COMMITS=$(git log --format="%ae" ${{ github.event.pull_request.base.sha }}..${{ github.sha }} | wc -l)
if [ "$AMD_COMMITS" -gt 0 ] && [ "$AMD_COMMITS" -eq "$ALL_COMMITS" ]; then
echo "require_amd_copyright=true" >> $GITHUB_OUTPUT
echo "✓ AMD employee detected - requiring AMD copyright"
else
echo "require_amd_copyright=false" >> $GITHUB_OUTPUT
echo "✓ External contributor detected - allowing any copyright"
fi
- name: Check copyright notices
run: |
if [ "${{ steps.changed-files.outputs.require_amd_copyright }}" == "true" ]; then
python .github/scripts/check_copyright.py --changed-files "${{ steps.changed-files.outputs.changed_files }}" --require-amd
else
python .github/scripts/check_copyright.py --changed-files "${{ steps.changed-files.outputs.changed_files }}"
fi
- name: Display summary
if: success()
run: |
echo "### ✅ Copyright Notice Check Passed" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ steps.changed-files.outputs.require_amd_copyright }}" == "true" ]; then
echo "All eligible files contain the required AMD copyright notice." >> $GITHUB_STEP_SUMMARY
else
echo "All eligible files contain valid copyright notices with MIT license." >> $GITHUB_STEP_SUMMARY
fi