Skip to content

Commit a844fef

Browse files
authored
Merge branch 'main' into aeisenberg/concat-not-push
2 parents 7ce9ef9 + d750c6d commit a844fef

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

.github/workflows/script/update-required-checks.sh

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
# Update the required checks based on the current branch.
33
# Typically, this will be main.
44

5-
if [ -z "$GITHUB_TOKEN" ]; then
6-
echo "Failed: No GitHub token found. This script requires admin access to `github/codeql-action`."
5+
if ! gh auth status 2>/dev/null; then
6+
gh auth status
7+
echo "Failed: Not authorized. This script requires admin access to github/codeql-action through the gh CLI."
78
exit 1
89
fi
910

1011
if [ "$#" -eq 1 ]; then
11-
# If we were passed an argument, pass it as a query to fzf
12-
GITHUB_SHA="$@"
12+
# If we were passed an argument, use that as the SHA
13+
GITHUB_SHA="$0"
1314
elif [ "$#" -gt 1 ]; then
1415
echo "Usage: $0 [SHA]"
1516
echo "Update the required checks based on the SHA, or main."
17+
exit 1
1618
elif [ -z "$GITHUB_SHA" ]; then
1719
# If we don't have a SHA, use main
1820
GITHUB_SHA="$(git rev-parse main)"
@@ -21,7 +23,7 @@ fi
2123
echo "Getting checks for $GITHUB_SHA"
2224

2325
# Ignore any checks with "https://", CodeQL, LGTM, and Update checks.
24-
CHECKS="$(gh api repos/github/codeql-action/commits/${GITHUB_SHA}/check-runs --paginate | jq --slurp --compact-output --raw-output '[.[].check_runs | .[].name | select(contains("https://") or . == "CodeQL" or . == "LGTM.com" or contains("Update") or contains("update") | not)] | unique | sort')"
26+
CHECKS="$(gh api repos/github/codeql-action/commits/"${GITHUB_SHA}"/check-runs --paginate | jq --slurp --compact-output --raw-output '[.[].check_runs | .[].name | select(contains("https://") or . == "CodeQL" or . == "LGTM.com" or contains("Update") or contains("update") | not)] | unique | sort')"
2527

2628
echo "$CHECKS" | jq
2729

0 commit comments

Comments
 (0)