Skip to content

Commit 6f5ccda

Browse files
authored
Merge pull request #33 from co-browser/32-feature-improve-ci
32 feature improve ci
2 parents ad471cc + a1aa6b4 commit 6f5ccda

File tree

9 files changed

+173
-65
lines changed

9 files changed

+173
-65
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,34 @@ labels: bug
66
assignees: ""
77
---
88

9-
**Describe the bug** A clear and concise description of what the bug is.
9+
## Describe the bug
1010

11-
**To Reproduce** Steps to reproduce the behavior:
11+
A clear and concise description of what the bug is.
12+
13+
## To Reproduce
14+
15+
Steps to reproduce the behavior:
1216

1317
1. Go to '...'
1418
2. Click on '....'
1519
3. Scroll down to '....'
1620
4. See error
1721

18-
**Expected behavior** A clear and concise description of what you expected to
19-
happen.
22+
Expected behavior
23+
24+
A clear and concise description of what you expected to happen.
2025

21-
**Screenshots** If applicable, add screenshots to help explain your problem.
26+
Screenshots
2227

23-
**Environment (please complete the following information):**
28+
If applicable, add screenshots to help explain your problem.
29+
30+
## Environment (please complete the following information):
2431

2532
- OS: [e.g. macOS, Windows, Linux]
2633
- Version [e.g. 1.2.3]
2734
- Client [if applicable]
2835
- Version [e.g. 1.2.3]
2936

30-
**Additional context** Add any other context about the problem here.
37+
## Additional context
38+
39+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@ labels: enhancement
66
assignees: ""
77
---
88

9-
**Is your feature request related to a problem? Please describe.** A clear and
10-
concise description of what the problem is. Ex. I'm always frustrated when [...]
9+
## Is your feature request related to a problem? Please describe.
1110

12-
**Describe the solution you'd like** A clear and concise description of what you
13-
want to happen.
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
1412

15-
**Describe alternatives you've considered** A clear and concise description of
13+
## Describe the solution you'd like
14+
15+
A clear and concise description of what you want to happen.
16+
17+
## Describe alternatives you've considered
18+
19+
A clear and concise description of
1620
any alternative solutions or features you've considered.
1721

18-
**Additional context** Add any other context or screenshots about the feature
19-
request here.
22+
## Additional context
23+
24+
Add any other context or screenshots about the feature request here.

.github/workflows/ci.yml

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
---
12
name: CI
23

34
on:
4-
push:
5-
branches: [main]
65
pull_request:
7-
workflow_dispatch:
6+
branches:
7+
- main
8+
release:
9+
types: [published] # Trigger when a release is published
810

911
concurrency:
1012
group: ${{ github.workflow }}-${{ github.ref_name }}-${{
@@ -17,40 +19,14 @@ env:
1719
IMAGE_NAME: ${{ github.repository }}
1820

1921
jobs:
20-
determine_changes:
21-
name: "Determine changes"
22-
runs-on: ubuntu-latest
23-
outputs:
24-
# Flag that is raised when any code is changed
25-
code: ${{ steps.changed.outputs.code_any_changed }}
26-
steps:
27-
- uses: actions/checkout@v4
28-
with:
29-
fetch-depth: 0
30-
31-
- uses: tj-actions/changed-files@v45
32-
id: changed
33-
with:
34-
files_yaml: |
35-
code:
36-
- "**/*"
37-
- "!docs/**/*"
38-
- "!mkdocs.*.yml"
39-
- "!**/*.md"
40-
- "!bin/**"
41-
- "!assets/**"
42-
- "!dist/**"
43-
# Generated markdown and JSON files are checked during test runs
44-
- "docs/reference/cli.md"
45-
- "docs/reference/settings.md"
46-
- "docs/configuration/environment.md"
47-
- "uv.schema.json"
4822
lint:
4923
timeout-minutes: 10
5024
name: "lint"
5125
runs-on: ubuntu-latest
5226
steps:
5327
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 1
5430

5531
- uses: actions/setup-python@v5
5632
with:
@@ -59,28 +35,21 @@ jobs:
5935
- name: "Install uv"
6036
uses: astral-sh/setup-uv@v5
6137

62-
- name: "Prettier"
63-
run: |
64-
npx prettier --check "**/*.{json5,yaml,yml}"
65-
npx prettier --prose-wrap always --check "**/*.md"
66-
6738
- name: "Python format"
6839
run: uvx ruff format --diff .
6940

7041
- name: "Python lint"
7142
run: uvx ruff check .
7243

7344
- name: "Validate project metadata"
74-
run: uvx --from 'validate-pyproject[all,store]' validate-pyproject
75-
pyproject.toml
45+
run: uvx --from 'validate-pyproject[all,store]' validate-pyproject pyproject.toml
7646

7747
build-and-publish:
7848
runs-on: ubuntu-latest
7949

8050
permissions:
8151
contents: read
8252
packages: write
83-
# attestations: write
8453
id-token: write
8554

8655
steps:

.github/workflows/mega-linter.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
# MegaLinter GitHub Action configuration file
3+
# More info at https://megalinter.io
4+
name: MegaLinter
5+
6+
on:
7+
push:
8+
branches: [main]
9+
pull_request:
10+
branches: [main]
11+
12+
permissions: read-all
13+
14+
env: # Comment env block if you don't want to apply fixes
15+
# Apply linter fixes configuration
16+
APPLY_FIXES: all # When active, APPLY_FIXES must also be defined as environment variable (in github/workflows/mega-linter.yml or other CI tool)
17+
APPLY_FIXES_EVENT: none # Decide which event triggers application of fixes in a commit or a PR (pull_request, push, all)
18+
APPLY_FIXES_MODE: commit # If APPLY_FIXES is used, defines if the fixes are directly committed (commit) or posted in a PR (pull_request)
19+
20+
concurrency:
21+
group: ${{ github.ref }}-${{ github.workflow }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
megalinter:
26+
name: MegaLinter
27+
runs-on: ubuntu-latest
28+
permissions:
29+
contents: read
30+
issues: write
31+
pull-requests: write
32+
steps:
33+
# Git Checkout
34+
- name: Checkout Code
35+
uses: actions/checkout@v4
36+
with:
37+
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
38+
fetch-depth: 0 # If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to improve performances
39+
# MegaLinter
40+
- name: MegaLinter
41+
id: ml
42+
# deployed v8.3.0, https://github.com/oxsecurity/megalinter/releases/tag/v8.3.0
43+
uses: oxsecurity/megalinter@1fc052d03c7a43c78fe0fee19c9d648b749e0c01
44+
env:
45+
# All available variables are described in documentation
46+
# https://megalinter.io/configuration/
47+
VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} # Validates all source when push on main, else just the git diff with main. Override with true if you always want to lint all sources
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
# Upload MegaLinter artifacts
50+
- name: Archive production artifacts
51+
if: success() || failure()
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: MegaLinter reports
55+
path: |
56+
megalinter-reports
57+
mega-linter.log
58+

.github/workflows/python-publish.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Upload Python Package
23

34
on:
@@ -19,6 +20,8 @@ jobs:
1920

2021
steps:
2122
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 1
2225

2326
- name: Set up uv and Python
2427
uses: astral-sh/setup-uv@v5

.github/workflows/release.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Tag and Release
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: write
11+
issues: write
12+
pull-requests: write
13+
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Use Node.js
25+
uses: actions/setup-node@v4
26+
27+
- name: Run semantic-release
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE }}
30+
run: npx semantic-release --branches main --plugins "@semantic-release/commit-analyzer,@semantic-release/release-notes-generator,@semantic-release/github"

.mega-linter.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
# Configuration file for MegaLinter
3+
# See all available variables at https://megalinter.io/configuration/ and in linters documentation
4+
5+
DISABLE_LINTERS:
6+
- SPELL_CSPELL
7+
- SPELL_LYCHEE
8+
9+
DISABLE_ERRORS_LINTERS:
10+
- COPYPASTE_JSCPD
11+
- DOCKERFILE_HADOLINT
12+
- MARKDOWN_MARKDOWN_LINK_CHECK
13+
- REPOSITORY_CHECKOV
14+
- REPOSITORY_DEVSKIM
15+
- REPOSITORY_KICS
16+
- REPOSITORY_TRIVY
17+
18+
EMAIL_REPORTER: false
19+
FILEIO_REPORTER: false
20+
MARKDOWN_SUMMARY_REPORTER: true
21+
SHOW_ELAPSED_TIME: true

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
1818
--mount=type=bind,source=uv.lock,target=uv.lock \
1919
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
2020
uv sync --frozen --no-install-project --no-dev
21-
ADD . /app
21+
COPY . /app
2222
RUN --mount=type=cache,target=/root/.cache/uv \
2323
uv sync --frozen --no-dev
2424

@@ -52,8 +52,10 @@ RUN apt-get update && \
5252
rm -rf /var/cache/apt/*
5353

5454
# Copy only necessary files from builder
55-
COPY --from=builder --chown=python:python /python /python
56-
COPY --from=builder --chown=app:app /app /app
55+
COPY --from=builder /python /python
56+
COPY --from=builder /app /app
57+
# Set proper permissions
58+
RUN chmod -R 755 /python /app
5759

5860
ENV PATH="/app/.venv/bin:$PATH" \
5961
DISPLAY=:0 \

README.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ uv tool update-shell
2727

2828
Create a `.env` file:
2929

30-
```
30+
```bash
3131
OPENAI_API_KEY=your-api-key
3232
CHROME_PATH=optional/path/to/chrome
3333
PATIENT=false # Set to true if API calls should wait for task completion
@@ -65,7 +65,7 @@ browser-use-mcp-server run server --port 8000 --stdio --proxy-port 9000
6565

6666
## Client Configuration
6767

68-
### SSE Mode
68+
### SSE Mode Client Configuration
6969

7070
```json
7171
{
@@ -77,7 +77,7 @@ browser-use-mcp-server run server --port 8000 --stdio --proxy-port 9000
7777
}
7878
```
7979

80-
### stdio Mode
80+
### stdio Mode Client Configuration
8181

8282
```json
8383
{
@@ -154,18 +154,29 @@ To develop and test the package locally:
154154

155155
## Docker
156156

157+
Using Docker provides a consistent and isolated environment for running the server.
158+
157159
```bash
158-
# Run with default VNC password
160+
# Build the Docker image
159161
docker build -t browser-use-mcp-server .
162+
163+
# Run the container with the default VNC password ("browser-use")
164+
# --rm ensures the container is automatically removed when it stops
165+
# -p 8000:8000 maps the server port
166+
# -p 5900:5900 maps the VNC port
160167
docker run --rm -p8000:8000 -p5900:5900 browser-use-mcp-server
161168

162-
# Use custom VNC password
163-
echo "your-password" > vnc_password.txt
169+
# Run with a custom VNC password read from a file
170+
# Create a file (e.g., vnc_password.txt) containing only your desired password
171+
echo "your-secure-password" > vnc_password.txt
172+
# Mount the password file as a secret inside the container
164173
docker run --rm -p8000:8000 -p5900:5900 \
165-
-v $(pwd)/vnc_password.txt:/run/secrets/vnc_password \
174+
-v $(pwd)/vnc_password.txt:/run/secrets/vnc_password:ro \
166175
browser-use-mcp-server
167176
```
168177

178+
*Note: The `:ro` flag in the volume mount (`-v`) makes the password file read-only inside the container for added security.*
179+
169180
### VNC Viewer
170181

171182
```bash
@@ -175,7 +186,7 @@ cd noVNC
175186
./utils/novnc_proxy --vnc localhost:5900
176187
```
177188

178-
Default password: `browser-use`
189+
Default password: `browser-use` (unless overridden using the custom password method)
179190

180191
<div align="center">
181192
<img width="428" alt="VNC Screenshot" src="https://github.com/user-attachments/assets/45bc5bee-418d-4182-94f5-db84b4fc0b3a" />
@@ -187,7 +198,7 @@ Default password: `browser-use`
187198

188199
Try asking your AI:
189200

190-
```
201+
```text
191202
open https://news.ycombinator.com and return the top ranked article
192203
```
193204

0 commit comments

Comments
 (0)