Skip to content

Commit

Permalink
add github workflow to check task owners
Browse files Browse the repository at this point in the history
  • Loading branch information
tisutisu committed Aug 19, 2024
1 parent 21db0a0 commit 8ea2b01
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/check-task-owners.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Validate PR - check task owners
'on':
pull_request:
branches: [main]
jobs:
check:
name: Check Task OWNERS
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Check task owners
run: |
./hack/check-task-owners.sh
25 changes: 25 additions & 0 deletions hack/check-task-owners.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

check_result=$(mktemp)

# Check the OWNERS file is present for each task
find task/ -mindepth 1 -maxdepth 1 -type d | \
while read -r task_dir; do
owners_file="$task_dir/OWNERS"
if [ ! -e "$owners_file" ]; then
echo "error: missing owners file $owners_file" >>"$check_result"
continue
fi
approvers=$(yq '.approvers[]' $owners_file)
reviewers=$(yq '.reviwers[]' $owners_file)
if [ -z "$approvers" ] && [ -z "$reviewers" ]; then
echo "error: $task_dir/OWNERS don't have atleast 1 approver and 1 reviewer" >>"$check_result"
fi
done

if [ -s "$check_result" ]; then
cat "$check_result"
echo "Please add OWNERS file with atleast 1 approver and 1 reviewer"
exit 1
fi

5 changes: 5 additions & 0 deletions task/acs-deploy-check/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See the OWNERS docs: https://go.k8s.io/owners
approvers:
- build-team
reviewers:
- build-team
5 changes: 5 additions & 0 deletions task/acs-image-check/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See the OWNERS docs: https://go.k8s.io/owners
approvers:
- build-team
reviewers:
- build-team
5 changes: 5 additions & 0 deletions task/acs-image-scan/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See the OWNERS docs: https://go.k8s.io/owners
approvers:
- build-team
reviewers:
- build-team
5 changes: 5 additions & 0 deletions task/buildah-remote-oci-ta/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See the OWNERS docs: https://go.k8s.io/owners
approvers:
- build-team
reviewers:
- build-team
5 changes: 5 additions & 0 deletions task/download-sbom-from-url-in-attestation/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See the OWNERS docs: https://go.k8s.io/owners
approvers:
- build-team
reviewers:
- build-team
5 changes: 5 additions & 0 deletions task/gather-deploy-images/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See the OWNERS docs: https://go.k8s.io/owners
approvers:
- build-team
reviewers:
- build-team
6 changes: 6 additions & 0 deletions task/rpm-ostree/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#See the OWNERS docs: https://go.k8s.io/owners
approvers:
- cgwalters
reviewers:
- cgwalters
5 changes: 5 additions & 0 deletions task/upload-sbom-to-trustification/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See the OWNERS docs: https://go.k8s.io/owners
approvers:
- build-team
reviewers:
- build-team

0 comments on commit 8ea2b01

Please sign in to comment.