SCRAPE-10: Implement recordScraperRun() for scraper_runs (#15)

Co-authored-by: Stephen Minakian <stephenminakian@gmail.com>
Co-committed-by: Stephen Minakian <stephenminakian@gmail.com>
This commit is contained in:
2026-02-06 02:00:19 -07:00
committed by stephen
parent b4978caf31
commit d1f717891a
3 changed files with 364 additions and 16 deletions

View File

@ -109,11 +109,23 @@ jobs:
steps:
- name: Send results to n8n webhook
env:
LINT_STATUS: ${{ needs.lint.result }}
TEST_STATUS: ${{ needs.test.result }}
RAW_LINT_OUTPUT: ${{ needs.lint.outputs.output }}
RAW_TEST_OUTPUT: ${{ needs.test.outputs.output }}
GH_REPO: ${{ github.repository }}
GH_BRANCH: ${{ github.head_ref || github.ref_name }}
GH_SHA: ${{ github.sha }}
GH_COMMIT_MSG: ${{ github.event.head_commit.message || github.event.pull_request.title || 'N/A' }}
GH_ACTOR: ${{ github.actor }}
GH_EVENT: ${{ github.event_name }}
GH_PR_NUMBER: ${{ github.event.pull_request.number || '' }}
GH_RUN_ID: ${{ github.run_id }}
GH_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
WEBHOOK_URL: ${{ secrets.N8N_WEBHOOK_URL }}
run: |
# Determine overall status
LINT_STATUS="${{ needs.lint.result }}"
TEST_STATUS="${{ needs.test.result }}"
if [ "$LINT_STATUS" = "success" ] && [ "$TEST_STATUS" = "success" ]; then
OVERALL_STATUS="success"
else
@ -121,21 +133,21 @@ jobs:
fi
# Truncate outputs if too long (max 10000 chars each)
LINT_OUTPUT=$(echo '${{ needs.lint.outputs.output }}' | head -c 10000)
TEST_OUTPUT=$(echo '${{ needs.test.outputs.output }}' | head -c 10000)
LINT_OUTPUT=$(echo "$RAW_LINT_OUTPUT" | head -c 10000)
TEST_OUTPUT=$(echo "$RAW_TEST_OUTPUT" | head -c 10000)
# Build JSON payload
PAYLOAD=$(jq -n \
--arg repo "${{ github.repository }}" \
--arg branch "${{ github.head_ref || github.ref_name }}" \
--arg commit "${{ github.sha }}" \
--arg commit_short "$(echo '${{ github.sha }}' | cut -c1-7)" \
--arg commit_message "${{ github.event.head_commit.message || github.event.pull_request.title || 'N/A' }}" \
--arg author "${{ github.actor }}" \
--arg event "${{ github.event_name }}" \
--arg pr_number "${{ github.event.pull_request.number || '' }}" \
--arg run_id "${{ github.run_id }}" \
--arg run_url "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
--arg repo "$GH_REPO" \
--arg branch "$GH_BRANCH" \
--arg commit "$GH_SHA" \
--arg commit_short "${GH_SHA:0:7}" \
--arg commit_message "$GH_COMMIT_MSG" \
--arg author "$GH_ACTOR" \
--arg event "$GH_EVENT" \
--arg pr_number "$GH_PR_NUMBER" \
--arg run_id "$GH_RUN_ID" \
--arg run_url "$GH_RUN_URL" \
--arg overall_status "$OVERALL_STATUS" \
--arg lint_status "$LINT_STATUS" \
--arg lint_output "$LINT_OUTPUT" \
@ -175,7 +187,7 @@ jobs:
curl -X POST \
-H "Content-Type: application/json" \
-d "$PAYLOAD" \
"${{ secrets.N8N_WEBHOOK_URL }}" \
"$WEBHOOK_URL" \
--fail --silent --show-error
- name: Fail if lint or tests failed