Spaces:
Running
Running
Delete .github
Browse files- .github/hf-space-config.yml +0 -11
- .github/workflows/ai-review.yml +0 -138
- .github/workflows/deploy-to-hugging-face.yml +0 -18
- .github/workflows/on-pull-request-to-main.yml +0 -9
- .github/workflows/on-push-to-main.yml +0 -7
- .github/workflows/publish-docker-image.yml +0 -39
- .github/workflows/reusable-test-lint-ping.yml +0 -26
.github/hf-space-config.yml
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
title: MiniSearch
|
| 2 |
-
emoji: ππ
|
| 3 |
-
colorFrom: yellow
|
| 4 |
-
colorTo: yellow
|
| 5 |
-
sdk: docker
|
| 6 |
-
short_description: Minimalist web-searching app with browser-based AI assistant
|
| 7 |
-
pinned: true
|
| 8 |
-
custom_headers:
|
| 9 |
-
cross-origin-embedder-policy: require-corp
|
| 10 |
-
cross-origin-opener-policy: same-origin
|
| 11 |
-
cross-origin-resource-policy: cross-origin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.github/workflows/ai-review.yml
DELETED
|
@@ -1,138 +0,0 @@
|
|
| 1 |
-
name: Review Pull Request with AI
|
| 2 |
-
|
| 3 |
-
on:
|
| 4 |
-
pull_request:
|
| 5 |
-
types: [opened, synchronize, reopened]
|
| 6 |
-
branches: ["main"]
|
| 7 |
-
|
| 8 |
-
concurrency:
|
| 9 |
-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
| 10 |
-
cancel-in-progress: true
|
| 11 |
-
|
| 12 |
-
jobs:
|
| 13 |
-
ai-review:
|
| 14 |
-
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ai-review') }}
|
| 15 |
-
continue-on-error: true
|
| 16 |
-
runs-on: ubuntu-latest
|
| 17 |
-
name: AI Review
|
| 18 |
-
permissions:
|
| 19 |
-
pull-requests: write
|
| 20 |
-
contents: read
|
| 21 |
-
timeout-minutes: 30
|
| 22 |
-
steps:
|
| 23 |
-
- name: Checkout Repository
|
| 24 |
-
uses: actions/checkout@v5
|
| 25 |
-
|
| 26 |
-
- name: Create temporary directory
|
| 27 |
-
run: mkdir -p /tmp/pr_review
|
| 28 |
-
|
| 29 |
-
- name: Process PR description
|
| 30 |
-
id: process_pr
|
| 31 |
-
run: |
|
| 32 |
-
PR_BODY_ESCAPED=$(cat << 'EOF'
|
| 33 |
-
${{ github.event.pull_request.body }}
|
| 34 |
-
EOF
|
| 35 |
-
)
|
| 36 |
-
PROCESSED_BODY=$(echo "$PR_BODY_ESCAPED" | sed -E 's/\[(.*?)\]\(.*?\)/\1/g')
|
| 37 |
-
echo "$PROCESSED_BODY" > /tmp/pr_review/processed_body.txt
|
| 38 |
-
|
| 39 |
-
- name: Fetch branches and output the diff
|
| 40 |
-
run: |
|
| 41 |
-
git fetch origin main:main
|
| 42 |
-
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-branch
|
| 43 |
-
git diff main..pr-branch > /tmp/pr_review/diff.txt
|
| 44 |
-
|
| 45 |
-
- name: Prepare review request
|
| 46 |
-
id: prepare_request
|
| 47 |
-
run: |
|
| 48 |
-
PR_TITLE=$(echo "${{ github.event.pull_request.title }}" | sed 's/[()]/\\&/g')
|
| 49 |
-
DIFF_CONTENT=$(cat /tmp/pr_review/diff.txt)
|
| 50 |
-
PROCESSED_BODY=$(cat /tmp/pr_review/processed_body.txt)
|
| 51 |
-
|
| 52 |
-
jq -n \
|
| 53 |
-
--arg model "${{ vars.OPENAI_COMPATIBLE_API_MODEL }}" \
|
| 54 |
-
--arg http_referer "${{ github.event.repository.html_url }}" \
|
| 55 |
-
--arg title "${{ github.event.repository.name }}" \
|
| 56 |
-
--arg system "You are an experienced developer reviewing a Pull Request. You focus only on what matters and provide concise, actionable feedback.
|
| 57 |
-
|
| 58 |
-
Review Context:
|
| 59 |
-
Repository Name: \"${{ github.event.repository.name }}\"
|
| 60 |
-
Repository Description: \"${{ github.event.repository.description }}\"
|
| 61 |
-
Branch: \"${{ github.event.pull_request.head.ref }}\"
|
| 62 |
-
PR Title: \"$PR_TITLE\"
|
| 63 |
-
|
| 64 |
-
Guidelines:
|
| 65 |
-
1. Only comment on issues that:
|
| 66 |
-
- Could cause bugs or security issues
|
| 67 |
-
- Significantly impact performance
|
| 68 |
-
- Make the code harder to maintain
|
| 69 |
-
- Violate critical best practices
|
| 70 |
-
|
| 71 |
-
2. For each issue:
|
| 72 |
-
- Point to the specific line/file
|
| 73 |
-
- Explain why it's a problem
|
| 74 |
-
- Suggest a concrete fix
|
| 75 |
-
|
| 76 |
-
3. Praise exceptional solutions briefly, only if truly innovative
|
| 77 |
-
|
| 78 |
-
4. Skip commenting on:
|
| 79 |
-
- Minor style issues
|
| 80 |
-
- Obvious changes
|
| 81 |
-
- Working code that could be marginally improved
|
| 82 |
-
- Things that are just personal preference
|
| 83 |
-
|
| 84 |
-
Remember:
|
| 85 |
-
Less is more. If the code is good and working, just say so, with a short message." \
|
| 86 |
-
--arg user "This is the description of the pull request:
|
| 87 |
-
\`\`\`markdown
|
| 88 |
-
$PROCESSED_BODY
|
| 89 |
-
\`\`\`
|
| 90 |
-
|
| 91 |
-
And here is the diff of the changes, for you to review:
|
| 92 |
-
\`\`\`diff
|
| 93 |
-
$DIFF_CONTENT
|
| 94 |
-
\`\`\`" \
|
| 95 |
-
'{
|
| 96 |
-
"model": $model,
|
| 97 |
-
"messages": [
|
| 98 |
-
{"role": "system", "content": $system},
|
| 99 |
-
{"role": "user", "content": $user}
|
| 100 |
-
],
|
| 101 |
-
"temperature": 0.7,
|
| 102 |
-
"top_p": 0.9
|
| 103 |
-
}' > /tmp/pr_review/request.json
|
| 104 |
-
- name: Get AI Review
|
| 105 |
-
id: ai_review
|
| 106 |
-
run: |
|
| 107 |
-
RESPONSE=$(curl -s ${{ vars.OPENAI_COMPATIBLE_API_BASE_URL }}/chat/completions \
|
| 108 |
-
-H "Content-Type: application/json" \
|
| 109 |
-
-H "Authorization: Bearer ${{ secrets.OPENAI_COMPATIBLE_API_KEY }}" \
|
| 110 |
-
-d @/tmp/pr_review/request.json)
|
| 111 |
-
|
| 112 |
-
# Check for errors in the response
|
| 113 |
-
if echo "$RESPONSE" | jq -e '.object == "error"' > /dev/null; then
|
| 114 |
-
echo "Error from API:" >&2
|
| 115 |
-
ERROR_MSG=$(echo "$RESPONSE" | jq -r '.message.detail[0].msg // .message')
|
| 116 |
-
echo "$ERROR_MSG" >&2
|
| 117 |
-
exit 1
|
| 118 |
-
fi
|
| 119 |
-
|
| 120 |
-
echo "### Review" > /tmp/pr_review/response.txt
|
| 121 |
-
echo "" >> /tmp/pr_review/response.txt
|
| 122 |
-
echo "$RESPONSE" | jq -r '.choices[0].message.content' >> /tmp/pr_review/response.txt
|
| 123 |
-
|
| 124 |
-
- name: Find Comment
|
| 125 |
-
uses: peter-evans/find-comment@v3
|
| 126 |
-
id: find_comment
|
| 127 |
-
with:
|
| 128 |
-
issue-number: ${{ github.event.pull_request.number }}
|
| 129 |
-
comment-author: "github-actions[bot]"
|
| 130 |
-
body-includes: "### Review"
|
| 131 |
-
|
| 132 |
-
- name: Post or Update PR Review
|
| 133 |
-
uses: peter-evans/create-or-update-comment@v4
|
| 134 |
-
with:
|
| 135 |
-
comment-id: ${{ steps.find_comment.outputs.comment-id }}
|
| 136 |
-
issue-number: ${{ github.event.pull_request.number }}
|
| 137 |
-
body-path: /tmp/pr_review/response.txt
|
| 138 |
-
edit-mode: replace
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.github/workflows/deploy-to-hugging-face.yml
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
name: Deploy to Hugging Face
|
| 2 |
-
|
| 3 |
-
on:
|
| 4 |
-
workflow_dispatch:
|
| 5 |
-
|
| 6 |
-
jobs:
|
| 7 |
-
sync-to-hf:
|
| 8 |
-
name: Sync to Hugging Face Spaces
|
| 9 |
-
runs-on: ubuntu-latest
|
| 10 |
-
steps:
|
| 11 |
-
- uses: actions/checkout@v5
|
| 12 |
-
- uses: JacobLinCool/huggingface-sync@v1
|
| 13 |
-
with:
|
| 14 |
-
github: ${{ secrets.GITHUB_TOKEN }}
|
| 15 |
-
user: ${{ vars.HF_SPACE_OWNER }}
|
| 16 |
-
space: ${{ vars.HF_SPACE_NAME }}
|
| 17 |
-
token: ${{ secrets.HF_TOKEN }}
|
| 18 |
-
configuration: ".github/hf-space-config.yml"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.github/workflows/on-pull-request-to-main.yml
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
name: On Pull Request To Main
|
| 2 |
-
on:
|
| 3 |
-
pull_request:
|
| 4 |
-
types: [opened, synchronize, reopened]
|
| 5 |
-
branches: ["main"]
|
| 6 |
-
jobs:
|
| 7 |
-
test-lint-ping:
|
| 8 |
-
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-test-lint-ping') }}
|
| 9 |
-
uses: ./.github/workflows/reusable-test-lint-ping.yml
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.github/workflows/on-push-to-main.yml
DELETED
|
@@ -1,7 +0,0 @@
|
|
| 1 |
-
name: On Push To Main
|
| 2 |
-
on:
|
| 3 |
-
push:
|
| 4 |
-
branches: ["main"]
|
| 5 |
-
jobs:
|
| 6 |
-
test-lint-ping:
|
| 7 |
-
uses: ./.github/workflows/reusable-test-lint-ping.yml
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.github/workflows/publish-docker-image.yml
DELETED
|
@@ -1,39 +0,0 @@
|
|
| 1 |
-
name: Publish Docker Image
|
| 2 |
-
|
| 3 |
-
on:
|
| 4 |
-
workflow_dispatch:
|
| 5 |
-
|
| 6 |
-
jobs:
|
| 7 |
-
build-and-push-image:
|
| 8 |
-
name: Publish Docker Image to GitHub Packages
|
| 9 |
-
runs-on: ubuntu-latest
|
| 10 |
-
env:
|
| 11 |
-
REGISTRY: ghcr.io
|
| 12 |
-
IMAGE_NAME: ${{ github.repository }}
|
| 13 |
-
permissions:
|
| 14 |
-
contents: read
|
| 15 |
-
packages: write
|
| 16 |
-
steps:
|
| 17 |
-
- name: Checkout repository
|
| 18 |
-
uses: actions/checkout@v5
|
| 19 |
-
- name: Log in to the Container registry
|
| 20 |
-
uses: docker/login-action@v3
|
| 21 |
-
with:
|
| 22 |
-
registry: ${{ env.REGISTRY }}
|
| 23 |
-
username: ${{ github.actor }}
|
| 24 |
-
password: ${{ secrets.GITHUB_TOKEN }}
|
| 25 |
-
- name: Extract metadata (tags, labels) for Docker
|
| 26 |
-
id: meta
|
| 27 |
-
uses: docker/metadata-action@v5
|
| 28 |
-
with:
|
| 29 |
-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
| 30 |
-
- name: Set up Docker Buildx
|
| 31 |
-
uses: docker/setup-buildx-action@v3
|
| 32 |
-
- name: Build and push Docker Image
|
| 33 |
-
uses: docker/build-push-action@v6
|
| 34 |
-
with:
|
| 35 |
-
context: .
|
| 36 |
-
push: true
|
| 37 |
-
tags: ${{ steps.meta.outputs.tags }}
|
| 38 |
-
labels: ${{ steps.meta.outputs.labels }}
|
| 39 |
-
platforms: linux/amd64,linux/arm64
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.github/workflows/reusable-test-lint-ping.yml
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
on:
|
| 2 |
-
workflow_call:
|
| 3 |
-
jobs:
|
| 4 |
-
check-code-quality:
|
| 5 |
-
name: Check Code Quality
|
| 6 |
-
runs-on: ubuntu-latest
|
| 7 |
-
steps:
|
| 8 |
-
- uses: actions/checkout@v5
|
| 9 |
-
- uses: actions/setup-node@v4
|
| 10 |
-
with:
|
| 11 |
-
node-version: "lts/*"
|
| 12 |
-
cache: "npm"
|
| 13 |
-
- run: npm ci --ignore-scripts
|
| 14 |
-
- run: npm test
|
| 15 |
-
- run: npm run lint
|
| 16 |
-
check-docker-container:
|
| 17 |
-
needs: [check-code-quality]
|
| 18 |
-
name: Check Docker Container
|
| 19 |
-
runs-on: ubuntu-latest
|
| 20 |
-
steps:
|
| 21 |
-
- uses: actions/checkout@v5
|
| 22 |
-
- run: docker compose -f docker-compose.production.yml up -d
|
| 23 |
-
- name: Check if main page is available
|
| 24 |
-
run: until curl -s -o /dev/null -w "%{http_code}" localhost:7860 | grep 200; do sleep 1; done
|
| 25 |
-
timeout-minutes: 1
|
| 26 |
-
- run: docker compose -f docker-compose.production.yml down
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|