chore(automation): ensure status/need-triage is applied and never cleared automatically (#16657)

This commit is contained in:
Bryan Morgan
2026-01-14 20:58:50 -05:00
committed by GitHub
parent 4f324b548e
commit 467e869326
8 changed files with 268 additions and 98 deletions

View File

@@ -30,9 +30,10 @@
set -e -E
# Load environment variables from .env if it exists
if [ -f ".env" ]; then
if [[ -f ".env" ]]; then
echo "Loading environment variables from .env file..."
set -a # Automatically export all variables
# shellcheck source=/dev/null
source .env
set +a
fi
@@ -49,32 +50,32 @@ STREAM_MODE=false
# Parse command line arguments
while [[ "$#" -gt 0 ]]; do
case $1 in
--payload) PAYLOAD_FILE="$2"; shift ;;
--model) MODEL_ID="$2"; shift ;;
--payload) PAYLOAD_FILE="${2}"; shift ;;
--model) MODEL_ID="${2}"; shift ;;
--stream) STREAM_MODE=true ;;
*) echo "Unknown parameter passed: $1"; usage ;;
*) echo "Unknown parameter passed: ${1}"; usage ;;
esac
shift
done
# Validate inputs
if [ -z "$PAYLOAD_FILE" ] || [ -z "$MODEL_ID" ]; then
if [[ -z "${PAYLOAD_FILE}" ]] || [[ -z "${MODEL_ID}" ]]; then
echo "Error: Missing required arguments."
usage
fi
if [ -z "$GEMINI_API_KEY" ]; then
if [[ -z "${GEMINI_API_KEY}" ]]; then
echo "Error: GEMINI_API_KEY environment variable is not set."
exit 1
fi
if [ ! -f "$PAYLOAD_FILE" ]; then
echo "Error: Payload file '$PAYLOAD_FILE' does not exist."
if [[ ! -f "${PAYLOAD_FILE}" ]]; then
echo "Error: Payload file '${PAYLOAD_FILE}' does not exist."
exit 1
fi
# API Endpoint definition
if [ "$STREAM_MODE" = true ]; then
if [[ "${STREAM_MODE}" = true ]]; then
GENERATE_CONTENT_API="streamGenerateContent"
echo "Mode: Streaming"
else
@@ -82,16 +83,18 @@ else
echo "Mode: Non-streaming (Default)"
fi
echo "Sending request to model: $MODEL_ID"
echo "Using payload from: $PAYLOAD_FILE"
echo "Sending request to model: ${MODEL_ID}"
echo "Using payload from: ${PAYLOAD_FILE}"
echo "----------------------------------------"
# Make the cURL request. If non-streaming, pipe through jq for readability if available.
if [ "$STREAM_MODE" = false ] && command -v jq &> /dev/null; then
curl -s -X POST \
if [[ "${STREAM_MODE}" = false ]] && command -v jq &> /dev/null; then
# Invoke curl separately to avoid masking its return value
output=$(curl -s -X POST \
-H "Content-Type: application/json" \
"https://generativelanguage.googleapis.com/v1beta/models/${MODEL_ID}:${GENERATE_CONTENT_API}?key=${GEMINI_API_KEY}" \
-d "@${PAYLOAD_FILE}" | jq .
-d "@${PAYLOAD_FILE}")
echo "${output}" | jq .
else
curl -X POST \
-H "Content-Type: application/json" \