Skip to content

Fix multiple file upload generation #316

Fix multiple file upload generation

Fix multiple file upload generation #316

Workflow file for this run

name: Docs
on:
pull_request:
release:
types: [published]
workflow_dispatch:
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build-preview:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
uses: ./.github/workflows/docs-deploy.yml
with:
checkout_ref: ${{ github.event.pull_request.head.sha }}
deploy_branch: pr-${{ github.event.pull_request.number }}
secrets:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
build-pr:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
uses: ./.github/workflows/docs-deploy.yml
with:
checkout_ref: ${{ github.event.pull_request.head.sha }}
build-production:
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/docs-deploy.yml
with:
checkout_ref: ${{ github.event_name == 'release' && github.event.release.tag_name || github.sha }}
deploy_branch: main
secrets:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
comment-preview:
runs-on: ubuntu-24.04
needs: build-preview
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
permissions:
issues: write
pull-requests: write
steps:
- name: Comment Preview URL on PR
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
with:
script: |
const previewUrl = 'https://pr-${{ github.event.pull_request.number }}.fastapi-code-generator.pages.dev';
const body = `📚 **Docs Preview:** ${previewUrl}`;
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
const existingComment = comments.data.find((comment) =>
comment.body && comment.body.includes('Docs Preview:')
);
if (existingComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id,
body,
});
} else {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body,
});
}