Refactor/arch insights ap fix #39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CodeAutopsy Architecture Scan | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| jobs: | |
| analyze-architecture: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write # Required for posting comments to the PR | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Call CodeAutopsy Engine | |
| id: autopsy | |
| run: | | |
| # 1. Hit your live Vercel API | |
| RESPONSE=$(curl -s -X POST https://codeautopsy-lyart.vercel.app/api/github-action \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"owner\": \"${{ github.repository_owner }}\", \"repo\": \"${{ github.event.repository.name }}\", \"commitSha\": \"${{ github.event.pull_request.head.sha }}\"}") | |
| # 2. Extract the markdown snippet using jq | |
| SNIPPET=$(echo "$RESPONSE" | jq -r '.markdownSnippet') | |
| # 3. Save to GitHub Environment for the next step | |
| { | |
| echo 'SNIPPET<<EOF' | |
| echo "$SNIPPET" | |
| echo 'EOF' | |
| } >> $GITHUB_ENV | |
| - name: Inject Interactive Map into PR | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # 4. Use GitHub CLI to post the comment | |
| gh pr comment ${{ github.event.pull_request.number }} --body "$SNIPPET" |