Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: qodo-ai/qodo-ci
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.4
Choose a base ref
...
head repository: qodo-ai/qodo-ci
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 15 commits
  • 7 files changed
  • 1 contributor

Commits on Jan 27, 2025

  1. Copy the full SHA
    719f33f View commit details

Commits on Jan 28, 2025

  1. Copy the full SHA
    331b7f3 View commit details
  2. act compatibility

    qododavid committed Jan 28, 2025
    Copy the full SHA
    153f851 View commit details

Commits on Jan 29, 2025

  1. Copy the full SHA
    7af87eb View commit details
  2. for testing pr mode locally

    qododavid committed Jan 29, 2025
    Copy the full SHA
    4841e96 View commit details
  3. Merge pull request #7 from qodo-ai/dw/act-local-debug

    new inputs, easier debugging
    qododavid authored Jan 29, 2025
    Copy the full SHA
    5d8ea7f View commit details

Commits on Feb 11, 2025

  1. update readme

    qododavid committed Feb 11, 2025
    Copy the full SHA
    146df13 View commit details
  2. Merge pull request #8 from qodo-ai/dw/update-readme

    update readme
    qododavid authored Feb 11, 2025
    Copy the full SHA
    ec60a03 View commit details

Commits on Feb 21, 2025

  1. Update README.md

    fix action ref
    qododavid authored Feb 21, 2025
    Copy the full SHA
    63d96db View commit details
  2. Merge pull request #9 from qodo-ai/qododavid-patch-1

    Update README.md
    qododavid authored Feb 21, 2025
    Copy the full SHA
    83afa24 View commit details
  3. use latest

    qododavid committed Feb 21, 2025
    Copy the full SHA
    a053f5b View commit details
  4. Merge pull request #11 from qodo-ai/dw/update-readme1

    use latest
    qododavid authored Feb 21, 2025
    Copy the full SHA
    e73daa5 View commit details
  5. update prerequisites

    qododavid committed Feb 21, 2025
    Copy the full SHA
    76e68a0 View commit details
  6. Merge pull request #12 from qodo-ai/dw/add-permission-screenshot

    update prerequisites
    qododavid authored Feb 21, 2025
    Copy the full SHA
    5aed1d9 View commit details
  7. Update README.md

    recommend `gpt-4o-2024-11-20`
    qododavid authored Feb 21, 2025
    Copy the full SHA
    ecca13a View commit details
11 changes: 10 additions & 1 deletion .github/actions/qodo-cover-pr/action.yml
Original file line number Diff line number Diff line change
@@ -41,6 +41,14 @@ inputs:
description: "Whether the agent should modify the test command to run individual tests"
required: false
default: "true"
source_folder:
description: "Path, relative to project_root, to look for source files. Will ignore source files outside this folder. Defaults to `.`"
required: false
default: "."
test_folder:
description: "Path, relative to project_root, to look for test files. Will ignore test files outside this folder. Defaults to `.`"
required: false
default: "."

runs:
using: "composite"
@@ -60,9 +68,10 @@ runs:
--max-iterations "${{ inputs.max_iterations }}" \
--desired-coverage "${{ inputs.desired_coverage }}" \
--run-each-test-separately "${{ inputs.run_each_test_separately }}" \
--source-folder "${{ inputs.source_folder }}" \
--test-folder "${{ inputs.test_folder }}" \
--action-path "${{ github.action_path }}" \
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
ACTION_REF: ${{ github.action_ref }}
<<: ${{ toJSON(env) }}
shell: bash
102 changes: 59 additions & 43 deletions .github/actions/qodo-cover-pr/scripts/run.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash
set -e

BINARY_PATH="/tmp/bin/cover-agent-pro"
BINARY_PATH="/usr/local/bin/cover-agent-pro"
REPORT_DIR="/tmp"
REPORT_PATH="$REPORT_DIR/report.txt"
MODIFIED_FILES_JSON="/tmp/modified-files.json"

LOCAL=${LOCAL:-false}

while [[ "$#" -gt 0 ]]; do
case $1 in
@@ -19,12 +20,20 @@ while [[ "$#" -gt 0 ]]; do
--max-iterations) MAX_ITERATIONS="$2"; shift ;;
--desired-coverage) DESIRED_COVERAGE="$2"; shift ;;
--run-each-test-separately) RUN_EACH_TEST_SEPARATELY="$2"; shift ;;
--source-folder) SOURCE_FOLDER="$2"; shift ;;
--test-folder) TEST_FOLDER="$2"; shift ;;
--action-path) ACTION_PATH="$2"; shift ;;
*) echo "Unknown parameter: $1"; exit 1 ;;
esac
shift
done

if [ "$LOCAL" = "false" ]; then
MODIFIED_FILES_JSON="/tmp/modified-files.json"
else
MODIFIED_FILES_JSON="$GITHUB_WORKSPACE/$PROJECT_ROOT/modified-files.json"
fi

# Install system dependencies
if ! (command -v wget >/dev/null && command -v sqlite3 >/dev/null && command -v jq >/dev/null); then
echo "Installing system dependencies..."
@@ -46,36 +55,38 @@ if [ "$PROJECT_LANGUAGE" == "python" ]; then
fi
fi

# Set up Git configuration
git config --global user.email "cover-bot@qodo.ai"
git config --global user.name "Qodo Cover"

# Download cover-agent-pro if not already downloaded
if [ ! -f "$BINARY_PATH" ]; then
echo "Downloading cover-agent-pro ${ACTION_REF}..."
mkdir -p /tmp/bin
wget -q -P /tmp/bin "https://github.com/qodo-ai/qodo-ci/releases/download/${ACTION_REF}/cover-agent-pro" >/dev/null
chmod +x "$BINARY_PATH"
fi
# Skip git if in local mode
if [ "$LOCAL" = "false" ]; then
# Set up Git configuration
git config --global user.email "cover-bot@qodo.ai"
git config --global user.name "Qodo Cover"

# Checkout the PR branch
git fetch origin "$PR_REF"
git checkout "$PR_REF"
# Checkout the PR branch
git fetch origin "$PR_REF"
git checkout "$PR_REF"

# Get the repository root
REPO_ROOT=$(git rev-parse --show-toplevel)
# Get the repository root
REPO_ROOT=$(git rev-parse --show-toplevel)

# Generate the modified files JSON using gh pr view, including only added or modified files
echo "Generating modified files list..."
gh pr view "$PR_NUMBER" --json files --jq '.files[].path' | \
jq -R -s 'split("\n")[:-1] | map("'"$REPO_ROOT"'/" + .)' > "$MODIFIED_FILES_JSON"
# Generate the modified files JSON using gh pr view, including only added or modified files
echo "Generating modified files list..."
gh pr view "$PR_NUMBER" --json files --jq '.files[].path' | \
jq -R -s 'split("\n")[:-1] | map("'"$REPO_ROOT"'/" + .)' > "$MODIFIED_FILES_JSON"
fi

# Check if modified-files.json is empty
if [ ! -s "$MODIFIED_FILES_JSON" ]; then
echo "No added or modified files found in the PR. Exiting."
exit 0
fi

# Download cover-agent-pro if not already downloaded
if [ ! -f "$BINARY_PATH" ]; then
echo "Downloading cover-agent-pro ${ACTION_REF}..."
wget -q -P /usr/local/bin "https://github.com/qodo-ai/qodo-ci/releases/download/${ACTION_REF}/cover-agent-pro" >/dev/null
chmod +x "$BINARY_PATH"
fi

# Run cover-agent-pro in pr mode with the provided arguments
"$BINARY_PATH" \
--mode "pr" \
@@ -88,30 +99,35 @@ fi
--max-iterations "$MAX_ITERATIONS" \
--desired-coverage "$DESIRED_COVERAGE" \
--run-each-test-separately "$RUN_EACH_TEST_SEPARATELY" \
--source-folder "$SOURCE_FOLDER" \
--test-folder "$TEST_FOLDER" \
--report-dir "$REPORT_DIR" \
--modified-files-json "$MODIFIED_FILES_JSON"

# Handle any changes made by cover-agent-pro
if [ -n "$(git status --porcelain)" ]; then
TIMESTAMP=$(date +%s)
BRANCH_NAME="qodo-cover-${PR_NUMBER}-${TIMESTAMP}"
# Skip git if in local mode
if [ "$LOCAL" = "false" ]; then
# Handle any changes made by cover-agent-pro
if [ -n "$(git status --porcelain)" ]; then
TIMESTAMP=$(date +%s)
BRANCH_NAME="qodo-cover-${PR_NUMBER}-${TIMESTAMP}"

if [ ! -f "$REPORT_PATH" ]; then
echo "Error: Report file not found at $REPORT_PATH"
exit 1
fi
if [ ! -f "$REPORT_PATH" ]; then
echo "Error: Report file not found at $REPORT_PATH"
exit 1
fi

REPORT_TEXT=$(cat "$REPORT_PATH")
PR_BODY=$(jinja2 "$ACTION_PATH/templates/pr_body_template.j2" -D pr_number="$PR_NUMBER" -D report="$REPORT_TEXT")

git checkout -b "$BRANCH_NAME"
git add .
git commit -m "Add tests to improve coverage"
git push origin "$BRANCH_NAME"

gh pr create \
--base "$PR_REF" \
--head "$BRANCH_NAME" \
--title "Qodo Cover Update: ${TIMESTAMP}" \
--body "$PR_BODY"
REPORT_TEXT=$(cat "$REPORT_PATH")
PR_BODY=$(jinja2 "$ACTION_PATH/templates/pr_body_template.j2" -D pr_number="$PR_NUMBER" -D report="$REPORT_TEXT")

git checkout -b "$BRANCH_NAME"
git add .
git commit -m "Add tests to improve coverage"
git push origin "$BRANCH_NAME"

gh pr create \
--base "$PR_REF" \
--head "$BRANCH_NAME" \
--title "Qodo Cover Update: ${TIMESTAMP}" \
--body "$PR_BODY"
fi
fi
11 changes: 10 additions & 1 deletion .github/actions/qodo-cover/action.yml
Original file line number Diff line number Diff line change
@@ -44,6 +44,14 @@ inputs:
branch:
description: "Branch to run on"
required: true
source_folder:
description: "Path, relative to project_root, to look for source files. Will ignore source files outside this folder. Defaults to `.`"
required: false
default: "."
test_folder:
description: "Path, relative to project_root, to look for test files. Will ignore test files outside this folder. Defaults to `.`"
required: false
default: "."

runs:
using: "composite"
@@ -62,9 +70,10 @@ runs:
--max-iterations "${{ inputs.max_iterations }}" \
--desired-coverage "${{ inputs.desired_coverage }}" \
--run-each-test-separately "${{ inputs.run_each_test_separately }}" \
--source-folder "${{ inputs.source_folder }}" \
--test-folder "${{ inputs.test_folder }}" \
--action-path "${{ github.action_path }}" \
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
ACTION_REF: ${{ github.action_ref }}
<<: ${{ toJSON(env) }}
shell: bash
72 changes: 42 additions & 30 deletions .github/actions/qodo-cover/scripts/run.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/bash
set -e

BINARY_PATH="/tmp/bin/cover-agent-pro"
BINARY_PATH="/usr/local/bin/cover-agent-pro"
REPORT_DIR="/tmp"
REPORT_PATH="$REPORT_DIR/report.txt"

LOCAL=${LOCAL:-false}

while [[ "$#" -gt 0 ]]; do
case $1 in
--branch) BRANCH="$2"; shift ;;
@@ -17,6 +19,8 @@ while [[ "$#" -gt 0 ]]; do
--max-iterations) MAX_ITERATIONS="$2"; shift ;;
--desired-coverage) DESIRED_COVERAGE="$2"; shift ;;
--run-each-test-separately) RUN_EACH_TEST_SEPARATELY="$2"; shift ;;
--source-folder) SOURCE_FOLDER="$2"; shift ;;
--test-folder) TEST_FOLDER="$2"; shift ;;
--action-path) ACTION_PATH="$2"; shift ;;
*) echo "Unknown parameter: $1"; exit 1 ;;
esac
@@ -44,21 +48,24 @@ if [ "$PROJECT_LANGUAGE" == "python" ]; then
fi
fi

# Set up Git configuration
git config --global user.email "cover-bot@qodo.ai"
git config --global user.name "Qodo Cover"
# Skip git if in local mode
if [ "$LOCAL" = "false" ]; then
# Set up Git configuration
git config --global user.email "cover-bot@qodo.ai"
git config --global user.name "Qodo Cover"

# Checkout the specified branch
git fetch origin
git checkout "$BRANCH"
fi

# Download cover-agent-pro if not already downloaded
if [ ! -f "$BINARY_PATH" ]; then
echo "Downloading cover-agent-pro ${ACTION_REF}..."
mkdir -p /tmp/bin
wget -q -P /tmp/bin "https://github.com/qodo-ai/qodo-ci/releases/download/${ACTION_REF}/cover-agent-pro" >/dev/null
wget -q -P /usr/local/bin "https://github.com/qodo-ai/qodo-ci/releases/download/${ACTION_REF}/cover-agent-pro" >/dev/null
chmod +x "$BINARY_PATH"
fi

# Checkout the specified branch
git fetch origin
git checkout "$BRANCH"

# Run cover-agent-pro
"$BINARY_PATH" \
@@ -71,29 +78,34 @@ git checkout "$BRANCH"
--max-iterations "$MAX_ITERATIONS" \
--desired-coverage "$DESIRED_COVERAGE" \
--run-each-test-separately "$RUN_EACH_TEST_SEPARATELY" \
--source-folder "$SOURCE_FOLDER" \
--test-folder "$TEST_FOLDER" \
--report-dir "$REPORT_DIR"

# If new changes
if [ -n "$(git status --porcelain)" ]; then
TIMESTAMP=$(date +%s)
BRANCH_NAME="qodo-ci-${BRANCH}-${TIMESTAMP}"
# Skip git if in local mode
if [ "$LOCAL" = "false" ]; then
# If new changes
if [ -n "$(git status --porcelain)" ]; then
TIMESTAMP=$(date +%s)
BRANCH_NAME="qodo-ci-${BRANCH}-${TIMESTAMP}"

if [ ! -f "$REPORT_PATH" ]; then
echo "Error: Report file not found at $REPORT_PATH"
exit 1
fi
if [ ! -f "$REPORT_PATH" ]; then
echo "Error: Report file not found at $REPORT_PATH"
exit 1
fi

REPORT_TEXT=$(cat "$REPORT_PATH")
PR_BODY=$(jinja2 "$ACTION_PATH/templates/pr_body_template.j2" -D target_branch="$BRANCH" -D report="$REPORT_TEXT")

REPORT_TEXT=$(cat "$REPORT_PATH")
PR_BODY=$(jinja2 "$ACTION_PATH/templates/pr_body_template.j2" -D target_branch="$BRANCH" -D report="$REPORT_TEXT")

git checkout -b "$BRANCH_NAME"
git add .
git commit -m "add tests"
git push origin "$BRANCH_NAME"

gh pr create \
--base "$BRANCH" \
--head "$BRANCH_NAME" \
--title "Qodo Cover Update: ${TIMESTAMP}" \
--body "$PR_BODY"
git checkout -b "$BRANCH_NAME"
git add .
git commit -m "add tests"
git push origin "$BRANCH_NAME"

gh pr create \
--base "$BRANCH" \
--head "$BRANCH_NAME" \
--title "Qodo Cover Update: ${TIMESTAMP}" \
--body "$PR_BODY"
fi
fi
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
qodo-ci.md
sink-config.yaml
sink.tmpl
Loading