From 2bb5ba8a1a18306160d2018a450b5d5b890559fa Mon Sep 17 00:00:00 2001 From: g_it Date: Wed, 8 Apr 2026 16:33:37 +0200 Subject: [PATCH] Adding AI assessment for Resume page. --- .forgejo/workflows/resume.yml | 112 ++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 .forgejo/workflows/resume.yml diff --git a/.forgejo/workflows/resume.yml b/.forgejo/workflows/resume.yml new file mode 100644 index 0000000..b00ff41 --- /dev/null +++ b/.forgejo/workflows/resume.yml @@ -0,0 +1,112 @@ +name: Resume Content Validation + +on: + push: + branches: + - main + pull_request: + +jobs: + validate-resume: + runs-on: docker + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - 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\" + }" + + RESPONSE=$(curl -s -X POST http://ollama:11434/api/generate \ + -H "Content-Type: application/json" \ + -d "{ + \"model\": \"phi:2.7b\", + \"prompt\": $(echo "$PROMPT" | jq -Rs .), + \"stream\": false + }") + + RESULT=$(echo "$RESPONSE" | jq -r '.response') + echo "validation_result=$RESULT" >> $GITHUB_OUTPUT + echo "$RESULT" + + - name: Parse validation result + if: steps.extract.outputs.content_found == 'true' + id: parse + run: | + RESULT="${{ steps.validate.outputs.validation_result }}" + + JSON=$(echo "$RESULT" | grep -o '{.*}' | head -1) + + if [ -z "$JSON" ]; then + echo "Could not parse response as JSON" + echo "assessment=FAIL" >> $GITHUB_OUTPUT + exit 1 + fi + + ASSESSMENT=$(echo "$JSON" | jq -r '.assessment') + TONE=$(echo "$JSON" | jq -r '.tone') + UNDERSTANDABILITY=$(echo "$JSON" | jq -r '.understandability') + REASON=$(echo "$JSON" | jq -r '.reason') + + echo "assessment=$ASSESSMENT" >> $GITHUB_OUTPUT + echo "tone=$TONE" >> $GITHUB_OUTPUT + echo "understandability=$UNDERSTANDABILITY" >> $GITHUB_OUTPUT + echo "reason=$REASON" >> $GITHUB_OUTPUT + + echo "---" + echo "Assessment: $ASSESSMENT" + echo "Tone: $TONE" + echo "Understandability: $UNDERSTANDABILITY" + echo "Reason: $REASON" + + - name: Block if assessment fails + if: steps.extract.outputs.content_found == 'true' + run: | + ASSESSMENT="${{ steps.parse.outputs.assessment }}" + + if [ "$ASSESSMENT" = "FAIL" ]; then + echo "❌ Resume assessment: FAIL" + echo "${{ steps.parse.outputs.reason }}" + exit 1 + else + echo "✅ Resume assessment: PASS" + echo "${{ steps.parse.outputs.reason }}" + fi + + - name: Resume not found + if: steps.extract.outputs.content_found == 'false' + run: | + echo "❌ content/resume.md not found" + exit 1