Skip to content

Commit

Permalink
chore: update docs for branch protection checks
Browse files Browse the repository at this point in the history
- add append to yaml in docs
- remove unique matrix items for checks
  • Loading branch information
BobyMCbobs committed Oct 6, 2023
1 parent 5191ded commit c32964c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion branch-protections.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ which may be set to provide check-based branch merge protection.
List checks for all GeoNet repos

```sh
./hack/list-checks.sh
./hack/list-checks.sh | tee /tmp/list-checks.yaml
```

and append the output to a yaml file.

List checks for a specific GeoNet repos

```sh
Expand Down
11 changes: 8 additions & 3 deletions hack/list-checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ get_status_checks() {
__debug_echo " - PR commit: $COMMIT"
while read CONTEXT; do
checks+=("$CONTEXT")
done < <(gh api "repos/$REPO/commits/$COMMIT/status" --jq '.statuses[].context')
done < <(gh api "repos/$REPO/commits/$COMMIT/status" --jq '.statuses[].context' | grep -vi travis)
done
CHECKS+=("${checks[@]}")
}
Expand All @@ -66,18 +66,23 @@ get_workflow_checks() {
while read RUN; do
__debug_echo " - Check run: $RUN"
checks+=("$RUN")
done < <(gh api "repos/$REPO/check-suites/$SUITE/check-runs" --jq .check_runs[].name)
done < <(gh api "repos/$REPO/check-suites/$SUITE/check-runs" --jq .check_runs[].name | sed 's/(.*) //' | grep -vi travis)
done < <(gh api "repos/$REPO/commits/$COMMIT/check-suites" --jq .check_suites[].id)
done
CHECKS+=("${checks[@]}")
}

get_checks() {
REPO="$1"
echo "$REPO:"
printf "$REPO:"
CHECKS=()
get_status_checks "$REPO"
get_workflow_checks "$REPO"
if [[ -z ${CHECKS[*]} ]]; then
echo ' []'
else
echo
fi
(
for CHECK in "${CHECKS[@]}"; do
echo " - $CHECK"
Expand Down

0 comments on commit c32964c

Please sign in to comment.