Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 32 additions & 11 deletions .github/workflows/assign_codeowners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,45 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Install yq
token: ${{ secrets.ACTION_TOKEN }}
persist-credentials: false

- name: Install yq and fd-find
run: |
sudo snap install yq
sudo apt install fd-find
sudo apt update
sudo apt install -y fd-find
# Create alias for fd-find
echo "alias fd=fdfind" >> ~/.bashrc
source ~/.bashrc

- 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: Commit CODEOWNERS changes
uses: EndBug/add-and-commit@v9
with:
add: '[".github/CODEOWNERS --force"]'
message: "Update CODEOWNERS file"
default_author: github_actions
cwd: "./"

- name: Check for CODEOWNERS changes
id: check_changes
run: |
if git diff --exit-code .github/CODEOWNERS; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi

- name: Commit and push changes
if: steps.check_changes.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

git add .github/CODEOWNERS
git commit -m "update CODEOWNERS file"

git remote set-url origin "https://x-access-token:${{ secrets.ACTION_TOKEN }}@github.com/mskcc-omics-workflows/modules.git"
git push --force-with-lease origin develop