From 1773fa0ae0cb81fff7f25dadddc54df9d67794a0 Mon Sep 17 00:00:00 2001 From: Parthvi Vala Date: Fri, 7 Feb 2025 16:32:45 +0530 Subject: [PATCH] Add GH action to run on pull request whenever there is focused check in the PR Signed-off-by: Parthvi Vala --- .github/scripts/focus-check.sh | 22 ++++++++++++++++++++++ .github/workflows/focus-ginkgo-checks.yml | 13 +++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 .github/scripts/focus-check.sh create mode 100644 .github/workflows/focus-ginkgo-checks.yml diff --git a/.github/scripts/focus-check.sh b/.github/scripts/focus-check.sh new file mode 100755 index 00000000..6dbab8ae --- /dev/null +++ b/.github/scripts/focus-check.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Note: This script has been generated by Gemini AI. + +# Get the absolute path to the repository root +repo_root=$(git rev-parse --show-toplevel) + +# Define the absolute path to the hosted directory +hosted_dir="$repo_root/hosted" + +# Use grep to search for the specified strings within .go files in the hosted directory +grep_result=$(grep -ErnI --include="*.go" -e "FIt" -e "FDescribe" -e "FContext" -e "FWhen" -e "FEntry" -e "FDescribeTable" "$hosted_dir") + +# Check if any matches were found +if [[ -n "$grep_result" ]]; then + echo "Found focused tests (FIt, FDescribe, etc.) in the '$hosted_dir' directory:" + echo "$grep_result" + exit 1 # Exit with a non-zero status to indicate failure +else + echo "No focused tests found in the '$hosted_dir' directory." + exit 0 # Exit with a zero status to indicate success +fi \ No newline at end of file diff --git a/.github/workflows/focus-ginkgo-checks.yml b/.github/workflows/focus-ginkgo-checks.yml new file mode 100644 index 00000000..1dbe0950 --- /dev/null +++ b/.github/workflows/focus-ginkgo-checks.yml @@ -0,0 +1,13 @@ +name: Checking for focused runs + +on: [push] + +jobs: + check-focus-target: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Running the focus check script + run: | + ./.github/scripts/focus-check.sh