require HF_TOKEN

This commit is contained in:
Adam Wilson
2025-08-19 15:47:06 -06:00
parent 31cd6fe1fc
commit a915215c86
2 changed files with 29 additions and 10 deletions
+28 -10
View File
@@ -3,9 +3,14 @@ on:
workflow_call:
secrets:
HF_TOKEN:
required: true
required: false # Changed from true to false
description: 'Hugging Face authentication token'
inputs:
HF_TOKEN_REQUIRED:
description: 'Whether HF_TOKEN is required for this workflow'
required: false
type: boolean
default: false
batch_offset:
description: 'Starting prompt index offset'
required: true
@@ -31,7 +36,7 @@ on:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 55 # Set max runtime for each job
timeout-minutes: 55 # Set max runtime for each job
continue-on-error: true
strategy:
# Always 10 batches per workflow
@@ -51,19 +56,32 @@ jobs:
shell: bash
run: pip install -r ${{ github.workspace }}/requirements.txt
- name: 'ensure HF_TOKEN'
- name: 'ensure HF_TOKEN (when required)'
if: ${{ inputs.HF_TOKEN_REQUIRED }}
shell: bash
run: |
echo "HF_TOKEN length: ${#HF_TOKEN}"
if [ -z "$HF_TOKEN" ]; then
echo "ERROR: HF_TOKEN is empty or not set"
echo "HF_TOKEN length: ${#HF_TOKEN}"
if [ -z "$HF_TOKEN" ]; then
echo "ERROR: HF_TOKEN is required but empty or not set"
exit 1
else
else
echo "HF_TOKEN is set: ${HF_TOKEN:0:3}..."
fi
fi
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_TOKEN: ${{ secrets.HF_TOKEN }}
- name: 'check HF_TOKEN status (when not required)'
if: ${{ !inputs.HF_TOKEN_REQUIRED }}
shell: bash
run: |
if [ -z "$HF_TOKEN" ]; then
echo "HF_TOKEN not provided (not required for this workflow)"
else
echo "HF_TOKEN provided: ${HF_TOKEN:0:3}..."
fi
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
- name: 'run text generation tests - ${{ inputs.model_display_name }} - range ${{ inputs.range_name }} batch ${{ matrix.batch }}'
shell: bash
env:
@@ -26,6 +26,7 @@ jobs:
secrets:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
with:
HF_TOKEN_REQUIRED: true
batch_offset: ${{ inputs.batch_offset }}
range_name: ${{ inputs.range_name }}
batch_size: ${{ inputs.batch_size }}