0
0
Fork 0
mirror of https://codeberg.org/forgejo/docs.git synced 2024-11-30 19:03:43 -05:00
forgejo-docs/.forgejo/workflows/pr.yml
Earl Warren cb05660c81
admin: CLI: generate from --help
because the output of `forgejo docs` is unusable
2023-12-31 17:02:46 +01:00

56 lines
1.9 KiB
YAML

name: pr
on:
pull_request_target:
jobs:
preview:
runs-on: docker
container:
image: node:20
steps:
- uses: https://code.forgejo.org/actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: lint
run: |
corepack enable
pnpm install --frozen-lockfile
pnpm run lint:remark
pnpm run format:prettier
git diff --exit-code
- name: scripts/cli-docs.sh
run: |
scripts/cli-docs.sh run ${{ env.GITHUB_BASE_REF }} > docs/admin/command-line.md
git diff --exit-code
- name: get forgejo.org and move the docs
run: |
git clone --recursive --depth 1 https://codeberg.org/forgejo/website/ /tmp/website
apt-get update -qq && apt-get install -qq -y rsync
rsync -av --delete ./ /tmp/website/forgejo-docs/${{ env.GITHUB_BASE_REF }}/
- name: install
run: |
cd /tmp/website
corepack enable
pnpm install --frozen-lockfile
- name: build
run: |
cd /tmp/website
colon=':'
branch=docs_pull_${{ github.event.pull_request.number }}
sed -i.orig -e "s|origin$colon '.*|origin$colon 'https$colon//forgejo.codeberg.page',|" -e "s|basePathname$colon '/'|basePathname$colon '/@$branch//'|" src/config.ts
cat src/config.ts
corepack enable
pnpm run build
mv dist /tmp
- name: preview
if: ${{ secrets.WEBSITETOKEN != '' }}
uses: https://code.forgejo.org/forgejo/action-website-preview@main
with:
directory: /tmp/dist
name: 'docs_pull_${{ github.event.pull_request.number }}'
pages-token: ${{ secrets.WEBSITETOKEN }}
repository: forgejo/docs
repository-host: codeberg.org
repository-token: ${{ secrets.WEBSITETOKEN }}
pr-number: ${{ github.event.pull_request.number }}