Dummy commit #6
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: AI Code Review | ||
|
Check failure on line 1 in .github/workflows/ai-code-review.yml
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| issues: read | ||
| id-token: write | ||
| on: | ||
| pull_request: | ||
| types: [opened, review_requested] | ||
| jobs: | ||
| get-commits: | ||
| if: ${{ secrets.KP_REVIEW_BOT_APP_ID != '' }} | ||
| runs-on: 'ubuntu-latest' | ||
| continue-on-error: true | ||
| outputs: | ||
| commits: ${{ steps.get-commits.outputs.commits }} | ||
| steps: | ||
| - name: Checkout Linux source tree | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 32 | ||
| # Get the list of commits and trigger a review job for each separate commit | ||
| # As a safeguard, check no more than the first 50 commits | ||
| - name: Get PR commits | ||
| id: get-commits | ||
| run: | | ||
| tmp=$(mktemp) | ||
| git rev-list ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | head -n 50 > pr_commits.txt | ||
| cat pr_commits.txt | tail -n +2 | jq -R -s -c 'split("\n")[:-1]' > $tmp | ||
| echo "commits=$(cat $tmp)" >> $GITHUB_OUTPUT | ||
| ai-review: | ||
| needs: get-commits | ||
| runs-on: 'ubuntu-latest' | ||
| continue-on-error: true | ||
| strategy: | ||
| matrix: | ||
| commit: ${{ fromJson(needs.get-commits.outputs.commits) }} | ||
| fail-fast: false | ||
| env: | ||
| AWS_REGION: us-west-2 | ||
| steps: | ||
| - name: Checkout CI code | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| sparse-checkout: | | ||
| .github | ||
| ci | ||
| - name: Generate GitHub App token | ||
| id: app-token | ||
| uses: actions/create-github-app-token@v2 | ||
| with: | ||
| app-id: ${{ secrets.KP_REVIEW_BOT_APP_ID }} | ||
| private-key: ${{ secrets.KP_REVIEW_BOT_APP_PRIVATE_KEY }} | ||
| - name: Configure AWS Credentials (OIDC) | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| role-to-assume: ${{ secrets.AWS_BEDROCK_ROLE }} | ||
| aws-region: us-west-2 | ||
| - name: Set up .claude/settings.json | ||
| shell: bash | ||
| run: | | ||
| mkdir -p ~/.claude | ||
| cp ci/claude/settings.json ~/.claude/settings.json | ||
| - name: Checkout Linux source tree | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 32 | ||
| ref: ${{ matrix.commit }} | ||
| - name: Checkout prompts repo | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| repository: 'kernel-patches/review-prompts' | ||
| path: 'review' | ||
| - uses: anthropics/claude-code-action@v1 | ||
| with: | ||
| github_token: ${{ steps.app-token.outputs.token }} | ||
| use_bedrock: "true" | ||
| claude_args: '--max-turns 100' | ||
| prompt: | | ||
| Current directory is the root of a Linux Kernel git repository. | ||
| Using the prompt `review/review-core.md` and the prompt directory `review` | ||
| do a code review of the top commit in the Linux repository. | ||
| - name: Dump review-inline.txt if exists | ||
| shell: bash | ||
| run: | | ||
| review_file=$(find ${{ github.workspace }} -name review-inline.txt) | ||
| cat $review_file | ||
| if [ -s "$review_file" ]; then | ||
| cp -f $review_file ${{ github.workspace }}/review-inline.txt || true | ||
| echo "### Inline review" >> $GITHUB_STEP_SUMMARY | ||
| echo "```" >> $GITHUB_STEP_SUMMARY | ||
| cat $review_file >> $GITHUB_STEP_SUMMARY | ||
| echo "```" >> $GITHUB_STEP_SUMMARY | ||
| fi | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ai-review-output | ||
| if-no-files-found: ignore | ||
| path: ${{ github.workspace }}/review-inline.txt | ||