@@ -46,49 +46,13 @@ jobs:
4646 echo "changed=true" >> $GITHUB_OUTPUT
4747 fi
4848
49- # Step 3: If no difference, exit early
50- # (all subsequent steps are gated on changed == 'true')
51-
52- # Step 4: Run validation against the NEW generated spec
53- - name : Run validation
54- if : steps.diff.outputs.changed == 'true'
55- id : validate
56- continue-on-error : true
57- env :
58- E2B_API_KEY : ${{ secrets.E2B_API_KEY }}
59- E2B_ACCESS_TOKEN : ${{ secrets.E2B_ACCESS_TOKEN }}
60- run : |
61- # Replace committed spec with generated one before validating
62- cp openapi-generated.yml openapi-public.yml
63-
64- # Capture the full output; the script exits 1 on critical findings
65- python3 scripts/validate_api_reference.py \
66- --output openapi-validation-report.md \
67- --verbose 2>&1 | tee validation-output.txt
68-
69- # Extract the final summary block (everything after the last ===... line)
70- SUMMARY=$(awk '/^={50,}/{buf=""} {buf=buf"\n"$0} END{print buf}' validation-output.txt)
71- # Store for PR body (escape newlines for GitHub output)
72- EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
73- echo "summary<<$EOF" >> $GITHUB_OUTPUT
74- echo "$SUMMARY" >> $GITHUB_OUTPUT
75- echo "$EOF" >> $GITHUB_OUTPUT
76-
77- # Step 5+6: Create PR with status indicator
49+ # Step 3: Create PR if spec has drifted
7850 - name : Create PR
7951 if : steps.diff.outputs.changed == 'true'
8052 env :
8153 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
82- VALIDATION_OUTCOME : ${{ steps.validate.outcome }}
83- VALIDATION_SUMMARY : ${{ steps.validate.outputs.summary }}
8454 run : |
85- if [ "$VALIDATION_OUTCOME" = "success" ]; then
86- STATUS_ICON="🟢"
87- STATUS_TEXT="Validation passed"
88- else
89- STATUS_ICON="🔴"
90- STATUS_TEXT="Validation failed — critical findings detected"
91- fi
55+ cp openapi-generated.yml openapi-public.yml
9256
9357 BRANCH="api-spec-update-$(date +%Y-%m-%d)"
9458 git config user.name "github-actions[bot]"
@@ -100,18 +64,12 @@ jobs:
10064 git push -u origin "$BRANCH"
10165
10266 gh pr create \
103- --title "$STATUS_ICON Update API spec $(date +%Y-%m-%d)" \
67+ --title "Update API spec $(date +%Y-%m-%d)" \
10468 --body "$(cat <<EOF
10569 ## OpenAPI Spec Update
10670
10771 The generated \`openapi-public.yml\` has drifted from the source specs.
10872 This PR updates it to match the latest upstream definitions.
109-
110- ### Validation: $STATUS_ICON $STATUS_TEXT
111-
112- \`\`\`
113- $VALIDATION_SUMMARY
114- \`\`\`
11573 EOF
11674 )" \
11775 --base main
@@ -120,11 +78,9 @@ jobs:
12078 if : always()
12179 env :
12280 CHANGED : ${{ steps.diff.outputs.changed }}
123- VALIDATION_OUTCOME : ${{ steps.validate.outcome }}
12481 run : |
12582 echo "## API Reference Spec Check" >> $GITHUB_STEP_SUMMARY
12683 echo "" >> $GITHUB_STEP_SUMMARY
12784 echo "| Result | Value |" >> $GITHUB_STEP_SUMMARY
12885 echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
12986 echo "| Spec changed | ${CHANGED:-false} |" >> $GITHUB_STEP_SUMMARY
130- echo "| Validation | ${VALIDATION_OUTCOME:-skipped} |" >> $GITHUB_STEP_SUMMARY
0 commit comments