fix: rewrite workflows without GitHub marketplace actions
Some checks failed
CI — Test & Build / Test & Build (push) Failing after 1m13s

- Use native git clone instead of actions/checkout
- Use node:22-bookworm container directly
- Remove dependency on actions/setup-node, upload-artifact
- Use curl for Gitea API calls directly
- Fixes CI failure on self-hosted runner
This commit is contained in:
Forge
2026-03-06 13:18:27 +08:00
parent 41db281824
commit 7f16bd886f
3 changed files with 75 additions and 103 deletions

View File

@@ -8,15 +8,18 @@ jobs:
preview-build:
name: PR Preview Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
container:
image: node:22-bookworm
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
steps:
- name: Install zip curl
run: apt-get update -qq && apt-get install -y zip curl
- name: Checkout PR
run: |
git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git .
git fetch origin pull/${{ gitea.event.pull_request.number }}/head:pr
git checkout pr
- name: Install dependencies
run: npm ci
@@ -25,28 +28,21 @@ jobs:
run: npm run typecheck
- name: Run unit tests
run: npm test
run: npm test -- --run
- name: Build extension
run: npm run build
- name: Package preview ZIP
run: npm run zip
- name: Upload PR artifact
uses: actions/upload-artifact@v4
with:
name: lexai-pr-${{ github.event.pull_request.number }}-preview
path: .output/lexai-*.zip
retention-days: 3
run: |
PR_NUM=${{ gitea.event.pull_request.number }}
zip -r lexai-pr-${PR_NUM}-preview.zip .output/chrome-mv3/
echo "✅ PR #${PR_NUM} build successful"
- name: Comment on PR
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `## ⚡ LexAI Preview Build Ready\n\n✅ Tests passed\n✅ Build successful\n\n📦 Download the extension ZIP from the **Artifacts** section above to test this PR.\n\nCommit: \`${{ github.sha }}\``
})
run: |
PR_NUM=${{ gitea.event.pull_request.number }}
curl -s -X POST "${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/issues/${PR_NUM}/comments" \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{\"body\": \"## ⚡ LexAI Preview Build Ready\n\n✅ Tests passed\n✅ Build successful\n✅ TypeScript clean\n\nCommit: \`${{ gitea.sha }}\`\"}"