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 148dd4b
Show file tree
Hide file tree
Showing 10 changed files with 87 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
31 changes: 31 additions & 0 deletions hack/check-task-owners.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

owners_missing=0
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"
owners_missing=1
continue
fi
approvers=$(yq '.approvers[]' $owners_file)
reviewers=$(yq '.reviwers[]' $owners_file)
if [ -z "$approvers" ] && [ -z "$reviewers" ]; then
echo "$task_dir/OWNERS don't have atleast 1 approver and 1 reviewer"
fi
done

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

# Exit with non zero error code if OWNERS file is missing
if [ "$owners_missing" -eq 1 ]; then
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 148dd4b

Please sign in to comment.