Add MuscleMap extension (Slicer3D_MuscleMap) #98
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: Extension AI Analysis | |
| on: | |
| pull_request_target: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| ai-analysis: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout the fork PR code | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| fetch-depth: 0 # Fetch full history for git diff | |
| - name: Setup Python | |
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| with: | |
| python-version: "3.12" | |
| cache: "pip" | |
| cache-dependency-path: scripts/requirements.txt | |
| - name: Configure git | |
| run: | | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "GitHub Action" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| echo "Installing dependencies from requirements.txt:" | |
| cat scripts/requirements.txt | |
| pip install -r scripts/requirements.txt | |
| echo "Verifying installed packages:" | |
| pip list | grep -E "(jsonschema|requests)" | |
| - name: Get changed files | |
| run: | | |
| mkdir -p /tmp/ai-analysis-reports | |
| # Upstream repo (base repository) | |
| UPSTREAM_REPO="${{ github.event.pull_request.base.repo.full_name }}" | |
| BASE_REF="${{ github.event.pull_request.base.ref }}" | |
| echo "Upstream repo: $UPSTREAM_REPO" | |
| echo "Base ref: $BASE_REF" | |
| # Add upstream remote and fetch latest base branch | |
| git remote add upstream "https://github.com/$UPSTREAM_REPO.git" | |
| git fetch upstream $BASE_REF | |
| # Checkout PR code | |
| git checkout ${{ github.event.pull_request.head.ref }} | |
| # Diff fork PR vs upstream base branch | |
| git diff --name-only --diff-filter=AM upstream/$BASE_REF...HEAD \ | |
| | grep -E '\.json$' > /tmp/ai-analysis-reports/changed_files.txt || true | |
| echo "Changed JSON files:" | |
| cat /tmp/ai-analysis-reports/changed_files.txt || echo "(none)" | |
| - name: Run AI analysis | |
| env: | |
| NEBULA_API_KEY: ${{ secrets.NEBULA_API_KEY }} | |
| id: ai-analysis | |
| run: | | |
| RESULT=$(python scripts/extension_ai_analysis.py \ | |
| $(cat /tmp/ai-analysis-reports/changed_files.txt | tr '\n' ' ')) | |
| echo "$RESULT" | |
| # Append result to GitHub Actions job summary | |
| echo "### AI Analysis Result" >> $GITHUB_STEP_SUMMARY | |
| echo "$RESULT" >> $GITHUB_STEP_SUMMARY |