mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-08-02 09:18:45 +02:00
chore: linting
This commit is contained in:
@@ -9,9 +9,6 @@ on:
|
||||
default: true
|
||||
type: boolean
|
||||
secrets:
|
||||
TAURI_WEBDRIVER_TOKEN:
|
||||
description: Read-only token for the test-driver repository
|
||||
required: false
|
||||
WAYFERN_TEST_TOKEN:
|
||||
description: Token used by the full Wayfern integration suite
|
||||
required: false
|
||||
@@ -64,15 +61,6 @@ jobs:
|
||||
- name: Checkout Donut Browser
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
path: donutbrowser
|
||||
persist-credentials: false
|
||||
|
||||
- name: Checkout test driver
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
repository: ${{ vars.TAURI_WEBDRIVER_REPOSITORY }}
|
||||
token: ${{ secrets.TAURI_WEBDRIVER_TOKEN || github.token }}
|
||||
path: tauri-wd
|
||||
persist-credentials: false
|
||||
|
||||
- name: Install pnpm
|
||||
@@ -83,9 +71,9 @@ jobs:
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
with:
|
||||
node-version-file: donutbrowser/.node-version
|
||||
node-version-file: .node-version
|
||||
cache: pnpm
|
||||
cache-dependency-path: donutbrowser/pnpm-lock.yaml
|
||||
cache-dependency-path: pnpm-lock.yaml
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # master
|
||||
@@ -96,9 +84,14 @@ jobs:
|
||||
uses: swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
|
||||
with:
|
||||
workspaces: |
|
||||
donutbrowser/src-tauri -> target
|
||||
donutbrowser/e2e/app -> target
|
||||
tauri-wd -> target
|
||||
src-tauri -> target
|
||||
e2e/app -> target
|
||||
|
||||
- name: Cache WebDriver test driver
|
||||
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: e2e/.driver
|
||||
key: tauri-wd-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('e2e/app/Cargo.lock') }}
|
||||
|
||||
- name: Install Tauri dependencies
|
||||
if: runner.os == 'Linux'
|
||||
@@ -107,11 +100,9 @@ jobs:
|
||||
sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libxdo-dev xvfb openvpn
|
||||
|
||||
- name: Install app dependencies
|
||||
working-directory: donutbrowser
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Run isolated smoke suite
|
||||
working-directory: donutbrowser
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${RUNNER_OS}" == "Linux" ]]; then
|
||||
@@ -139,15 +130,6 @@ jobs:
|
||||
- name: Checkout Donut Browser
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
path: donutbrowser
|
||||
persist-credentials: false
|
||||
|
||||
- name: Checkout test driver
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
repository: ${{ vars.TAURI_WEBDRIVER_REPOSITORY }}
|
||||
token: ${{ secrets.TAURI_WEBDRIVER_TOKEN || github.token }}
|
||||
path: tauri-wd
|
||||
persist-credentials: false
|
||||
|
||||
- name: Install pnpm
|
||||
@@ -158,9 +140,9 @@ jobs:
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
with:
|
||||
node-version-file: donutbrowser/.node-version
|
||||
node-version-file: .node-version
|
||||
cache: pnpm
|
||||
cache-dependency-path: donutbrowser/pnpm-lock.yaml
|
||||
cache-dependency-path: pnpm-lock.yaml
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # master
|
||||
@@ -171,16 +153,19 @@ jobs:
|
||||
uses: swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
|
||||
with:
|
||||
workspaces: |
|
||||
donutbrowser/src-tauri -> target
|
||||
donutbrowser/e2e/app -> target
|
||||
tauri-wd -> target
|
||||
src-tauri -> target
|
||||
e2e/app -> target
|
||||
|
||||
- name: Cache WebDriver test driver
|
||||
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: e2e/.driver
|
||||
key: tauri-wd-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('e2e/app/Cargo.lock') }}
|
||||
|
||||
- name: Install app dependencies
|
||||
working-directory: donutbrowser
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Run full isolated app suite
|
||||
working-directory: donutbrowser
|
||||
env:
|
||||
DONUT_E2E_SUITE: ${{ inputs.suite || 'full' }}
|
||||
DONUT_E2E_SKIP_NETWORK_TEST: "1"
|
||||
@@ -206,15 +191,6 @@ jobs:
|
||||
- name: Checkout Donut Browser
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
path: donutbrowser
|
||||
persist-credentials: false
|
||||
|
||||
- name: Checkout test driver
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
repository: ${{ vars.TAURI_WEBDRIVER_REPOSITORY }}
|
||||
token: ${{ secrets.TAURI_WEBDRIVER_TOKEN || github.token }}
|
||||
path: tauri-wd
|
||||
persist-credentials: false
|
||||
|
||||
- name: Install pnpm
|
||||
@@ -225,9 +201,9 @@ jobs:
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
with:
|
||||
node-version-file: donutbrowser/.node-version
|
||||
node-version-file: .node-version
|
||||
cache: pnpm
|
||||
cache-dependency-path: donutbrowser/pnpm-lock.yaml
|
||||
cache-dependency-path: pnpm-lock.yaml
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # master
|
||||
@@ -238,9 +214,14 @@ jobs:
|
||||
uses: swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
|
||||
with:
|
||||
workspaces: |
|
||||
donutbrowser/src-tauri -> target
|
||||
donutbrowser/e2e/app -> target
|
||||
tauri-wd -> target
|
||||
src-tauri -> target
|
||||
e2e/app -> target
|
||||
|
||||
- name: Cache WebDriver test driver
|
||||
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: e2e/.driver
|
||||
key: tauri-wd-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('e2e/app/Cargo.lock') }}
|
||||
|
||||
- name: Install Tauri dependencies
|
||||
run: |
|
||||
@@ -248,11 +229,9 @@ jobs:
|
||||
sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libxdo-dev xvfb openvpn
|
||||
|
||||
- name: Install app dependencies
|
||||
working-directory: donutbrowser
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Run isolated real-network suite
|
||||
working-directory: donutbrowser
|
||||
env:
|
||||
WAYFERN_TEST_TOKEN: ${{ secrets.WAYFERN_TEST_TOKEN }}
|
||||
RESIDENTIAL_PROXY_URL_ONE_SOCKS: ${{ secrets.RESIDENTIAL_PROXY_URL_ONE_SOCKS }}
|
||||
|
||||
@@ -84,14 +84,24 @@ jobs:
|
||||
response_format: { type: "json_object" }
|
||||
}')
|
||||
|
||||
RESPONSE=$(curl -fsSL https://models.github.ai/inference/chat/completions \
|
||||
# Never use curl -f here: a transport or quota error (402 once the repo's
|
||||
# GitHub Models allowance is spent) must not abort the job. The whole
|
||||
# step is fail-open, so capture the status and degrade instead.
|
||||
STATUS=$(curl -sSL -o /tmp/response.json -w '%{http_code}' \
|
||||
https://models.github.ai/inference/chat/completions \
|
||||
-H "Authorization: Bearer $GH_MODELS_TOKEN" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2026-03-10" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$PAYLOAD")
|
||||
-d "$PAYLOAD" || echo "000")
|
||||
|
||||
jq -r '.choices[0].message.content // empty' <<< "$RESPONSE" > /tmp/raw.txt
|
||||
if [ "$STATUS" != "200" ]; then
|
||||
echo "::warning::GitHub Models returned HTTP $STATUS; treating as compliant"
|
||||
echo '{"is_compliant": true, "non_compliance_reasons": []}' > /tmp/result.json
|
||||
exit 0
|
||||
fi
|
||||
|
||||
jq -r '.choices[0].message.content // empty' /tmp/response.json > /tmp/raw.txt || : > /tmp/raw.txt
|
||||
|
||||
# Strip accidental markdown fences and parse. On parse failure, fall back
|
||||
# to a compliant result so a flaky model never closes a legitimate issue.
|
||||
|
||||
@@ -243,14 +243,23 @@ jobs:
|
||||
]
|
||||
}')
|
||||
|
||||
RESPONSE=$(curl -fsSL https://models.github.ai/inference/chat/completions \
|
||||
# Never use curl -f here: a transport or quota error (402 once the repo's
|
||||
# GitHub Models allowance is spent) must not abort the job. Capture the
|
||||
# status and fall through to the safe classification below.
|
||||
STATUS=$(curl -sSL -o /tmp/triage-response.json -w '%{http_code}' \
|
||||
https://models.github.ai/inference/chat/completions \
|
||||
-H "Authorization: Bearer $GH_MODELS_TOKEN" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2026-03-10" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$PAYLOAD")
|
||||
-d "$PAYLOAD" || echo "000")
|
||||
|
||||
jq -r '.choices[0].message.content // empty' <<< "$RESPONSE" > /tmp/triage-raw.txt
|
||||
if [ "$STATUS" = "200" ]; then
|
||||
jq -r '.choices[0].message.content // empty' /tmp/triage-response.json > /tmp/triage-raw.txt || : > /tmp/triage-raw.txt
|
||||
else
|
||||
echo "::warning::GitHub Models returned HTTP $STATUS for triage"
|
||||
: > /tmp/triage-raw.txt
|
||||
fi
|
||||
|
||||
# Normalize optional markdown fences before parsing.
|
||||
sed -E 's/^```(json)?$//; s/```$//' /tmp/triage-raw.txt > /tmp/triage.json
|
||||
@@ -375,6 +384,7 @@ jobs:
|
||||
wc -c /tmp/composer-system.txt
|
||||
|
||||
- name: Stage 2 (compose response)
|
||||
id: compose
|
||||
env:
|
||||
GH_MODELS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ISSUE_AUTHOR: ${{ github.event.issue.user.login }}
|
||||
@@ -415,21 +425,34 @@ jobs:
|
||||
]
|
||||
}')
|
||||
|
||||
RESPONSE=$(curl -fsSL https://models.github.ai/inference/chat/completions \
|
||||
# Same as triage: a quota or transport error must not fail the run. When
|
||||
# no comment can be composed the remaining steps are skipped instead.
|
||||
STATUS=$(curl -sSL -o /tmp/compose-response.json -w '%{http_code}' \
|
||||
https://models.github.ai/inference/chat/completions \
|
||||
-H "Authorization: Bearer $GH_MODELS_TOKEN" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2026-03-10" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$PAYLOAD")
|
||||
-d "$PAYLOAD" || echo "000")
|
||||
|
||||
jq -r '.choices[0].message.content // empty' <<< "$RESPONSE" > /tmp/ai-comment.txt
|
||||
|
||||
if [ ! -s /tmp/ai-comment.txt ]; then
|
||||
echo "::error::Composer returned empty response"
|
||||
exit 1
|
||||
if [ "$STATUS" != "200" ]; then
|
||||
echo "::warning::GitHub Models returned HTTP $STATUS; skipping the triage comment"
|
||||
echo "has_comment=false" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
jq -r '.choices[0].message.content // empty' /tmp/compose-response.json > /tmp/ai-comment.txt || : > /tmp/ai-comment.txt
|
||||
|
||||
if [ ! -s /tmp/ai-comment.txt ]; then
|
||||
echo "::warning::Composer returned empty response; skipping the triage comment"
|
||||
echo "has_comment=false" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "has_comment=true" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Strip forbidden sections (defense in depth)
|
||||
if: steps.compose.outputs.has_comment == 'true'
|
||||
run: |
|
||||
# LLMs still emit "Possible cause" and friends despite the prompt rules.
|
||||
# Strip any such heading and its block, plus stray `Label:` lines left
|
||||
@@ -452,6 +475,7 @@ jobs:
|
||||
EOF
|
||||
|
||||
- name: Post comment (no labeling)
|
||||
if: steps.compose.outputs.has_comment == 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||
@@ -524,6 +548,7 @@ jobs:
|
||||
mv /tmp/pr-file-context.safe.txt /tmp/pr-file-context.txt
|
||||
|
||||
- name: Analyze PR with AI
|
||||
id: analyze
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_MODELS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -583,21 +608,34 @@ jobs:
|
||||
]
|
||||
}')
|
||||
|
||||
RESPONSE=$(curl -fsSL https://models.github.ai/inference/chat/completions \
|
||||
# A quota or transport error must not fail the run; skip the review
|
||||
# comment instead of red-crossing an otherwise healthy pull request.
|
||||
STATUS=$(curl -sSL -o /tmp/pr-response.json -w '%{http_code}' \
|
||||
https://models.github.ai/inference/chat/completions \
|
||||
-H "Authorization: Bearer $GH_MODELS_TOKEN" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2026-03-10" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$PAYLOAD")
|
||||
-d "$PAYLOAD" || echo "000")
|
||||
|
||||
jq -r '.choices[0].message.content // empty' <<< "$RESPONSE" > /tmp/ai-comment.txt
|
||||
|
||||
if [ ! -s /tmp/ai-comment.txt ]; then
|
||||
echo "::error::AI response was empty"
|
||||
exit 1
|
||||
if [ "$STATUS" != "200" ]; then
|
||||
echo "::warning::GitHub Models returned HTTP $STATUS; skipping the review comment"
|
||||
echo "has_comment=false" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
jq -r '.choices[0].message.content // empty' /tmp/pr-response.json > /tmp/ai-comment.txt || : > /tmp/ai-comment.txt
|
||||
|
||||
if [ ! -s /tmp/ai-comment.txt ]; then
|
||||
echo "::warning::AI response was empty; skipping the review comment"
|
||||
echo "has_comment=false" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "has_comment=true" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Post comment
|
||||
if: steps.analyze.outputs.has_comment == 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
|
||||
@@ -121,14 +121,25 @@ jobs:
|
||||
response_format: { type: "json_object" }
|
||||
}')
|
||||
|
||||
RESPONSE=$(curl -fsSL https://models.github.ai/inference/chat/completions \
|
||||
# Never use curl -f here: a transport or quota error (402 once the repo's
|
||||
# GitHub Models allowance is spent) must not abort the job. The model
|
||||
# half of this check is fail-open, and the deterministic trailer scan
|
||||
# below still runs regardless.
|
||||
STATUS=$(curl -sSL -o /tmp/response.json -w '%{http_code}' \
|
||||
https://models.github.ai/inference/chat/completions \
|
||||
-H "Authorization: Bearer $GH_MODELS_TOKEN" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2026-03-10" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$PAYLOAD")
|
||||
-d "$PAYLOAD" || echo "000")
|
||||
|
||||
jq -r '.choices[0].message.content // empty' <<< "$RESPONSE" > /tmp/raw.txt
|
||||
if [ "$STATUS" != "200" ]; then
|
||||
echo "::warning::GitHub Models returned HTTP $STATUS; treating as compliant"
|
||||
echo '{"compliant": true, "violations": []}' > /tmp/result.json
|
||||
exit 0
|
||||
fi
|
||||
|
||||
jq -r '.choices[0].message.content // empty' /tmp/response.json > /tmp/raw.txt || : > /tmp/raw.txt
|
||||
|
||||
# Strip accidental markdown fences and parse. On parse failure, fall
|
||||
# back to compliant so a flaky model never closes a legitimate PR.
|
||||
|
||||
@@ -46,7 +46,6 @@ jobs:
|
||||
name: Cross-platform App E2E
|
||||
uses: ./.github/workflows/app-e2e.yml
|
||||
secrets:
|
||||
TAURI_WEBDRIVER_TOKEN: ${{ secrets.TAURI_WEBDRIVER_TOKEN }}
|
||||
WAYFERN_TEST_TOKEN: ${{ secrets.WAYFERN_TEST_TOKEN }}
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
Reference in New Issue
Block a user