Skip to content

Commit 4902876

Browse files
authored
ai_pr_summary workflow moved to workflows: section
Was in step_bundles section before by mistake
1 parent 928d9b6 commit 4902876

File tree

1 file changed

+64
-67
lines changed

1 file changed

+64
-67
lines changed

bitrise.yml

Lines changed: 64 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,70 @@ workflows:
513513
'\[Bitrise Analytics\].*🤖 Bitrise analytics enabled for tasks.*Invocation ID: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
514514
- deploy-to-bitrise-io@2: {}
515515

516+
ai_pr_summary:
517+
triggers:
518+
# run for pull requests; changed_files filter exposes the list of changed files
519+
pull_request:
520+
- target_branch: '*'
521+
source_branch: '*'
522+
changed_files: '*'
523+
# Set status_report_name to report the status of this workflow separately.
524+
status_report_name: 'AI Review'
525+
# Simple Medium Linux machine is enough
526+
meta:
527+
bitrise.io:
528+
machine_type_id: g2.linux.medium
529+
stack: linux-docker-android-22.04
530+
envs:
531+
- GITHUB_TOKEN: $AI_PR_REVIEWER_GITHUB_TOKEN
532+
- LLM_API_KEY: $AI_PR_REVIEWER_OPENAI_API_KEY
533+
steps:
534+
- activate-ssh-key@4:
535+
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
536+
537+
538+
title: Generate AI Review for PR
539+
inputs:
540+
- content: |-
541+
#!/bin/bash
542+
set -e
543+
544+
# Parse repository name from repo URL (works for SSH & HTTPS)
545+
REPO_URL="${GIT_REPOSITORY_URL}"
546+
REPO=$(echo "$REPO_URL" | sed -E 's#(git@|https://)([^/:]+)[/:]([^/]+)/([^.]+)(\.git)?#\3/\4#')
547+
548+
# 1. Unshallow the repo if it's a shallow clone (safe to run even if already full)
549+
git fetch --unshallow || true
550+
551+
# 2. Fetch all branch refs (this ensures both the PR and the target/destination branch are present)
552+
git fetch origin
553+
554+
# 3. Fetch both relevant branches explicitly for safety (redundant but safe)
555+
git fetch origin "$BITRISEIO_GIT_BRANCH_DEST"
556+
git fetch origin "$BITRISE_GIT_BRANCH"
557+
558+
# 4. Create/reset local branches to match the remote
559+
git checkout -B "$BITRISEIO_GIT_BRANCH_DEST" "origin/$BITRISEIO_GIT_BRANCH_DEST"
560+
git checkout -B "$BITRISE_GIT_BRANCH" "origin/$BITRISE_GIT_BRANCH"
561+
562+
# (Optionally: check out the PR branch if that is the branch you want to analyze)
563+
git checkout "$BITRISE_GIT_BRANCH"
564+
565+
# 5. Install AI reviewer plugin (customize source as needed)
566+
bitrise plugin install --source https://github.com/bitrise-io/bitrise-plugins-ai-reviewer.git
567+
568+
# 6. Run your AI reviewer (customize flags as needed)
569+
bitrise :ai-reviewer summarize \
570+
-m=gpt-4.1 \
571+
-c="${GIT_CLONE_COMMIT_HASH}" \
572+
-b="${BITRISEIO_GIT_BRANCH_DEST}" \
573+
-r=github \
574+
--pr="${BITRISE_PULL_REQUEST}" \
575+
--repo="${REPO}" \
576+
--log-level=debug
577+
578+
echo "Done! PR reviewed."
579+
516580
step_bundles:
517581
generate_gradle_verification_reference:
518582
steps:
@@ -672,74 +736,7 @@ step_bundles:
672736
inputs:
673737
- path: "./_tmp"
674738

675-
ai_pr_summary:
676-
# Simple Medium Linux machine is enough
677-
meta:
678-
bitrise.io:
679-
machine_type_id: g2.linux.medium
680-
stack: linux-docker-android-22.04
681-
envs:
682-
- GITHUB_TOKEN: $AI_PR_REVIEWER_GITHUB_TOKEN
683-
- LLM_API_KEY: $AI_PR_REVIEWER_OPENAI_API_KEY
684-
steps:
685-
- activate-ssh-key@4:
686-
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
687-
688-
689-
title: Generate AI Review for PR
690-
inputs:
691-
- content: |-
692-
#!/bin/bash
693-
set -e
694-
695-
# Parse repository name from repo URL (works for SSH & HTTPS)
696-
REPO_URL="${GIT_REPOSITORY_URL}"
697-
REPO=$(echo "$REPO_URL" | sed -E 's#(git@|https://)([^/:]+)[/:]([^/]+)/([^.]+)(\.git)?#\3/\4#')
698-
699-
# 1. Unshallow the repo if it's a shallow clone (safe to run even if already full)
700-
git fetch --unshallow || true
701-
702-
# 2. Fetch all branch refs (this ensures both the PR and the target/destination branch are present)
703-
git fetch origin
704-
705-
# 3. Fetch both relevant branches explicitly for safety (redundant but safe)
706-
git fetch origin "$BITRISEIO_GIT_BRANCH_DEST"
707-
git fetch origin "$BITRISE_GIT_BRANCH"
708-
709-
# 4. Create/reset local branches to match the remote
710-
git checkout -B "$BITRISEIO_GIT_BRANCH_DEST" "origin/$BITRISEIO_GIT_BRANCH_DEST"
711-
git checkout -B "$BITRISE_GIT_BRANCH" "origin/$BITRISE_GIT_BRANCH"
712-
713-
# (Optionally: check out the PR branch if that is the branch you want to analyze)
714-
git checkout "$BITRISE_GIT_BRANCH"
715-
716-
# 5. Install AI reviewer plugin (customize source as needed)
717-
bitrise plugin install --source https://github.com/bitrise-io/bitrise-plugins-ai-reviewer.git
718-
719-
# 6. Run your AI reviewer (customize flags as needed)
720-
bitrise :ai-reviewer summarize \
721-
-m=gpt-4.1 \
722-
-c="${GIT_CLONE_COMMIT_HASH}" \
723-
-b="${BITRISEIO_GIT_BRANCH_DEST}" \
724-
-r=github \
725-
--pr="${BITRISE_PULL_REQUEST}" \
726-
--repo="${REPO}" \
727-
--log-level=debug
728-
729-
echo "Done! PR reviewed."
730-
731739
pipelines:
732-
ai_pr_summary_pipeline:
733-
workflows:
734-
ai_pr_summary: {}
735-
triggers:
736-
# run for pull requests; changed_files filter exposes the list of changed files
737-
pull_request:
738-
- target_branch: '*'
739-
source_branch: '*'
740-
changed_files: '*'
741-
# Set status_report_name to report the status of this workflow separately.
742-
status_report_name: 'AI Review'
743740
features-e2e:
744741
workflows:
745742
test: {}

0 commit comments

Comments
 (0)