Skip to content

Update assign_codeowners.yml #94

Update assign_codeowners.yml

Update assign_codeowners.yml #94

name: Assign and Update Code Owners
on:
push:
branches: [test-codeowners] # Change to 'develop' after testing
jobs:
update-codeowners:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install yq and fd-find
run: |
sudo snap install yq
sudo apt update
sudo apt install -y fd-find
- name: Run generate_codeowners.sh
run: |
chmod +x .github/generate_codeowners.sh
./.github/generate_codeowners.sh
- name: Validate codeowners file
uses: mszostok/codeowners-validator@v0.7.4
with:
checks: "files,duppatterns,syntax"
- name: Check for CODEOWNERS changes
id: check_changes
run: |
git diff --exit-code .github/CODEOWNERS || echo "changed=true" >> $GITHUB_ENV
- name: Commit CODEOWNERS changes
if: env.changed == 'true'
run: |
BRANCH_NAME=update-codeowners-${GITHUB_RUN_NUMBER}
git checkout -b $BRANCH_NAME
git config user.name "github-actions"
git config user.email "github-actions@users.noreply.github.com"
git add .github/CODEOWNERS
git commit -m "Update CODEOWNERS file"
git push --set-upstream origin $BRANCH_NAME
- name: Create Pull Request
if: env.changed == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: develop
branch: update-codeowners-${{ github.run_number }}
title: "Update CODEOWNERS file"
body: "Automated update of CODEOWNERS"
draft: false