Two issues found during M8 E2E testing on Forgejo:
1. CI test failures (31 tests): Unit tests assume GitHub context but
Forgejo runner sets GITHUB_SERVER_URL=git.wxs.ro, causing
detectPlatform() to return "forgejo" and module-level constants in
config.ts to use Forgejo URLs. Fixed by setting GITHUB_SERVER_URL
in the test step env. Forgejo-specific tests already override with
PLATFORM=forgejo in their beforeEach.
2. Permission check 403: Forgejo's getCollaboratorPermissionLevel
requires admin access. Added checkForgejoPermissions() that uses
GET /repos/{owner}/{repo} instead — returns a permissions object
with { admin, push, pull } booleans for the authenticated token.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
91 lines
2.3 KiB
YAML
91 lines
2.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: grunt
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://${{ secrets.READ_REPO_TOKEN }}@git.wxs.ro/xternal/checkout@v6.0.2
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Install Bun
|
|
run: |
|
|
if command -v bun &> /dev/null; then
|
|
echo "Bun already installed: $(bun --version)"
|
|
else
|
|
curl -fsSL https://bun.sh/install | bash
|
|
echo "$HOME/.bun/bin" >> "$GITHUB_PATH"
|
|
fi
|
|
|
|
- name: Install dependencies
|
|
run: bun install
|
|
|
|
- name: Run tests
|
|
run: bun test
|
|
env:
|
|
# Unit tests assume GitHub context. Override Forgejo runner's
|
|
# GITHUB_SERVER_URL so module-level constants (config.ts) and
|
|
# detectPlatform() default to GitHub. Forgejo-specific tests
|
|
# explicitly set PLATFORM=forgejo in their own beforeEach.
|
|
GITHUB_SERVER_URL: https://github.com
|
|
|
|
prettier:
|
|
runs-on: grunt
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://${{ secrets.READ_REPO_TOKEN }}@git.wxs.ro/xternal/checkout@v6.0.2
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Install Bun
|
|
run: |
|
|
if command -v bun &> /dev/null; then
|
|
echo "Bun already installed: $(bun --version)"
|
|
else
|
|
curl -fsSL https://bun.sh/install | bash
|
|
echo "$HOME/.bun/bin" >> "$GITHUB_PATH"
|
|
fi
|
|
|
|
- name: Install dependencies
|
|
run: bun install
|
|
|
|
- name: Run prettier check
|
|
run: bun run format:check
|
|
|
|
typecheck:
|
|
runs-on: grunt
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://${{ secrets.READ_REPO_TOKEN }}@git.wxs.ro/xternal/checkout@v6.0.2
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Install Bun
|
|
run: |
|
|
if command -v bun &> /dev/null; then
|
|
echo "Bun already installed: $(bun --version)"
|
|
else
|
|
curl -fsSL https://bun.sh/install | bash
|
|
echo "$HOME/.bun/bin" >> "$GITHUB_PATH"
|
|
fi
|
|
|
|
- name: Install dependencies
|
|
run: bun install
|
|
|
|
- name: Run TypeScript type check
|
|
run: bun run typecheck
|