-
Notifications
You must be signed in to change notification settings - Fork 6
55 lines (46 loc) · 1.61 KB
/
Copy pathassign_codeowners.yml
File metadata and controls
55 lines (46 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Assign and Update Code Owners
on:
push:
branches: [develop]
jobs:
update-codeowners:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.ACTION_TOKEN }}
persist-credentials: false
- name: Install yq and fd-find
run: |
sudo snap install yq
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: 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