112 lines
4.7 KiB
YAML
112 lines
4.7 KiB
YAML
name: Resume Content Validation
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
jobs:
|
|
validate-resume:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
run: |
|
|
git clone --depth 1 https://token:${{ secrets.ACTIONS_TOKEN }}@gugulet.hu/technical/git/g_it/site.git .
|
|
|
|
- name: Extract resume content
|
|
id: extract
|
|
run: |
|
|
if [ -f "content/resume.md" ]; then
|
|
CONTENT=$(cat content/resume.md)
|
|
echo "content_found=true" >> $GITHUB_OUTPUT
|
|
echo "$CONTENT" > /tmp/resume.txt
|
|
else
|
|
echo "content_found=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Validate with Ollama
|
|
if: steps.extract.outputs.content_found == 'true'
|
|
id: validate
|
|
run: |
|
|
RESUME=$(cat /tmp/resume.txt)
|
|
|
|
PROMPT="You are a recruiting manager evaluating candidates for a Technical Writing position.
|
|
|
|
Assess this resume on:
|
|
1. Tone: Is it professional, confident, and appropriate for technical communication roles?
|
|
2. Understandability: Is the writing clear, well-organized, and easy to follow?
|
|
3. Technical Writing Skills: Does the candidate demonstrate ability to explain complex concepts clearly?
|
|
|
|
Resume:
|
|
$RESUME
|
|
|
|
Respond with JSON:
|
|
{
|
|
\"tone\": \"brief assessment\",
|
|
\"understandability\": \"brief assessment\",
|
|
\"assessment\": \"PASS or FAIL\",
|
|
\"reason\": \"one sentence explaining your decision\"
|
|
}"
|
|
|
|
echo "Testing Ollama connectivity on shared network..."
|
|
# Using the container name 'ollama' which resolves on the shared bridge network
|
|
curl -v http://ollama:11434/api/tags || echo "Ollama unreachable"
|
|
|
|
echo "Sending validation request to Ollama..."
|
|
RESPONSE=$(curl -s -X POST http://ollama:11434/api/generate \
|
|
-H "Content-Type: application/json" \
|
|
--max-time 300 \
|
|
-d "{
|
|
\"model\": \"phi:2.7b\",
|
|
\"prompt\": $(echo "$PROMPT" | jq -Rs .),
|
|
\"stream\": false
|
|
}")
|
|
|
|
echo "Raw response:"
|
|
echo "$RESPONSE"
|
|
echo "---"
|
|
|
|
if [ -z "$RESPONSE" ]; then
|
|
echo "Error: No response from Ollama"
|
|
exit 1
|
|
fi
|
|
|
|
RESULT=$(echo "$RESPONSE" | jq -r '.response' 2>/dev/null)
|
|
|
|
if [ -z "$RESULT" ] || [ "$RESULT" = "null" ]; then
|
|
echo "Error: Could not extract response from Ollama"
|
|
echo "Response was: $RESPONSE"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Ollama response:"
|
|
echo "$RESULT"
|
|
echo "validation_result=$RESULT" >> $GITHUB_OUTPUT
|
|
|
|
- name: Block if assessment fails
|
|
if: steps.extract.outputs.content_found == 'true'
|
|
run: |
|
|
# Note: The original workflow referenced steps.parse but it seems to be named validate here.
|
|
# Adjusting to use the output from the validate step.
|
|
# You may need to validate this based on your actual jq parsing logic in the prev step.
|
|
# Assuming RESULT contains the JSON string with assessment fields.
|
|
|
|
ASSESSMENT=$(echo "${{ steps.validate.outputs.validation_result }}" | jq -r '.assessment' 2>/dev/null)
|
|
REASON=$(echo "${{ steps.validate.outputs.validation_result }}" | jq -r '.reason' 2>/dev/null)
|
|
|
|
if [ "$ASSESSMENT" = "FAIL" ]; then
|
|
echo "Resume assessment: FAIL"
|
|
echo "$REASON"
|
|
exit 1
|
|
else
|
|
echo "Resume assessment: PASS"
|
|
echo "$REASON"
|
|
fi
|
|
|
|
- name: Resume not found
|
|
if: steps.extract.outputs.content_found == 'false'
|
|
run: |
|
|
echo "content/resume.md not found"
|
|
exit 1
|