Skip to content

Commit e5dbca9

Browse files
authored
Merge branch 'master' into fix-multiple-upload-file-in-swagger
2 parents be926b4 + ed7f49e commit e5dbca9

1,304 files changed

Lines changed: 18476 additions & 10803 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/dependabot.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,25 @@ updates:
55
directory: "/"
66
schedule:
77
interval: "daily"
8+
cooldown:
9+
default-days: 7
810
commit-message:
911
prefix:
1012
# Python
1113
- package-ecosystem: "uv"
1214
directory: "/"
1315
schedule:
14-
interval: "monthly"
16+
interval: "daily"
17+
cooldown:
18+
default-days: 7
19+
commit-message:
20+
prefix:
21+
# pre-commit
22+
- package-ecosystem: "pre-commit"
23+
directory: "/"
24+
schedule:
25+
interval: "daily"
26+
cooldown:
27+
default-days: 7
1528
commit-message:
1629
prefix:
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
name: Add to Project
22

33
on:
4-
pull_request_target:
4+
pull_request_target: # zizmor: ignore[dangerous-triggers]
55
issues:
66
types:
77
- opened
88
- reopened
99

10+
permissions: {}
11+
1012
jobs:
1113
add-to-project:
1214
name: Add to project
1315
runs-on: ubuntu-latest
1416
steps:
15-
- uses: actions/add-to-project@v1.0.2
17+
- uses: actions/add-to-project@5afcf98fcd03f1c2f92c3c83f58ae24323cc57fd # v2.0.0
1618
with:
1719
project-url: https://github.com/orgs/fastapi/projects/2
18-
github-token: ${{ secrets.PROJECTS_TOKEN }}
20+
github-token: ${{ secrets.PROJECTS_TOKEN }} # zizmor: ignore[secrets-outside-env]

.github/workflows/build-docs.yml

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
- opened
99
- synchronize
1010

11+
permissions: {}
12+
1113
jobs:
1214
changes:
1315
runs-on: ubuntu-latest
@@ -18,9 +20,11 @@ jobs:
1820
outputs:
1921
docs: ${{ steps.filter.outputs.docs }}
2022
steps:
21-
- uses: actions/checkout@v6
23+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
24+
with:
25+
persist-credentials: false
2226
# For pull requests it's not necessary to checkout the code but for the main branch it is
23-
- uses: dorny/paths-filter@v4
27+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
2428
id: filter
2529
with:
2630
filters: |
@@ -30,26 +34,28 @@ jobs:
3034
- docs_src/**
3135
- pyproject.toml
3236
- uv.lock
33-
- mkdocs.yml
34-
- mkdocs.env.yml
3537
- .github/workflows/build-docs.yml
3638
- .github/workflows/deploy-docs.yml
37-
- scripts/mkdocs_hooks.py
39+
- scripts/docs.py
3840
langs:
3941
needs:
4042
- changes
43+
if: ${{ needs.changes.outputs.docs == 'true' }}
4144
runs-on: ubuntu-latest
4245
outputs:
4346
langs: ${{ steps.show-langs.outputs.langs }}
4447
steps:
45-
- uses: actions/checkout@v6
48+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
49+
with:
50+
persist-credentials: false
4651
- name: Set up Python
47-
uses: actions/setup-python@v6
52+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
4853
with:
4954
python-version-file: ".python-version"
5055
- name: Setup uv
51-
uses: astral-sh/setup-uv@v7
56+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
5257
with:
58+
version: "0.11.4"
5359
enable-cache: true
5460
cache-dependency-glob: |
5561
pyproject.toml
@@ -75,14 +81,17 @@ jobs:
7581
env:
7682
GITHUB_CONTEXT: ${{ toJson(github) }}
7783
run: echo "$GITHUB_CONTEXT"
78-
- uses: actions/checkout@v6
84+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
85+
with:
86+
persist-credentials: false
7987
- name: Set up Python
80-
uses: actions/setup-python@v6
88+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
8189
with:
8290
python-version-file: ".python-version"
8391
- name: Setup uv
84-
uses: astral-sh/setup-uv@v7
92+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
8593
with:
94+
version: "0.11.4"
8695
enable-cache: true
8796
cache-dependency-glob: |
8897
pyproject.toml
@@ -91,27 +100,35 @@ jobs:
91100
run: uv sync --locked --no-dev --group docs
92101
- name: Update Languages
93102
run: uv run ./scripts/docs.py update-languages
94-
- uses: actions/cache@v5
103+
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
95104
with:
96-
key: mkdocs-cards-${{ matrix.lang }}-${{ github.ref }}
97-
path: docs/${{ matrix.lang }}/.cache
105+
key: zensical-${{ matrix.lang }}-${{ github.ref }}
106+
path: site_zensical_src/${{ matrix.lang }}/.cache
98107
- name: Build Docs
99-
run: uv run ./scripts/docs.py build-lang ${{ matrix.lang }}
100-
- uses: actions/upload-artifact@v7
108+
run: | # zizmor: ignore[template-injection] - comes from trusted source
109+
uv run ./scripts/docs.py build-lang ${{ matrix.lang }}
110+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
101111
with:
102112
name: docs-site-${{ matrix.lang }}
103-
path: ./site/**
113+
# English owns root static assets. Translated pages reference /img, /css,
114+
# and /js, so omit duplicated language-local copies from artifacts.
115+
path: |
116+
./site/**
117+
!./site/${{ matrix.lang }}/img/**
118+
!./site/${{ matrix.lang }}/css/**
119+
!./site/${{ matrix.lang }}/js/**
104120
include-hidden-files: true
105121

106122
# https://github.com/marketplace/actions/alls-green#why
107123
docs-all-green: # This job does nothing and is only used for the branch protection
108124
if: always()
109125
needs:
126+
- langs
110127
- build-docs
111128
runs-on: ubuntu-latest
112129
steps:
113130
- name: Decide whether the needed jobs succeeded or failed
114-
uses: re-actors/alls-green@release/v1
131+
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
115132
with:
116133
jobs: ${{ toJSON(needs) }}
117-
allowed-skips: build-docs
134+
allowed-skips: langs, build-docs

.github/workflows/contributors.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ on:
1010
required: false
1111
default: "false"
1212

13+
permissions: {}
14+
1315
jobs:
1416
job:
1517
if: github.repository_owner == 'fastapi'
@@ -21,14 +23,17 @@ jobs:
2123
env:
2224
GITHUB_CONTEXT: ${{ toJson(github) }}
2325
run: echo "$GITHUB_CONTEXT"
24-
- uses: actions/checkout@v6
26+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
27+
with:
28+
persist-credentials: true # Required for `git push` in `contributors.py`
2529
- name: Set up Python
26-
uses: actions/setup-python@v6
30+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2731
with:
2832
python-version-file: ".python-version"
2933
- name: Setup uv
30-
uses: astral-sh/setup-uv@v7
34+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
3135
with:
36+
version: "0.11.4"
3237
enable-cache: true
3338
cache-dependency-glob: |
3439
pyproject.toml
@@ -37,13 +42,13 @@ jobs:
3742
run: uv sync --locked --no-dev --group github-actions
3843
# Allow debugging with tmate
3944
- name: Setup tmate session
40-
uses: mxschmitt/action-tmate@v3
45+
uses: mxschmitt/action-tmate@c0afd6f790e3a5564914980036ebf83216678101 # v3.23
4146
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
4247
with:
4348
limit-access-to-actor: true
4449
env:
45-
GITHUB_TOKEN: ${{ secrets.FASTAPI_PR_TOKEN }}
50+
GITHUB_TOKEN: ${{ secrets.FASTAPI_PR_TOKEN }} # zizmor: ignore[secrets-outside-env]
4651
- name: FastAPI People Contributors
4752
run: uv run ./scripts/contributors.py
4853
env:
49-
GITHUB_TOKEN: ${{ secrets.FASTAPI_PR_TOKEN }}
54+
GITHUB_TOKEN: ${{ secrets.FASTAPI_PR_TOKEN }} # zizmor: ignore[secrets-outside-env]

.github/workflows/deploy-docs.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
11
name: Deploy Docs
22
on:
3-
workflow_run:
3+
workflow_run: # zizmor: ignore[dangerous-triggers]
44
workflows:
55
- Build Docs
66
types:
77
- completed
88

9-
permissions:
10-
deployments: write
11-
issues: write
12-
pull-requests: write
13-
statuses: write
9+
permissions: {}
1410

1511
jobs:
1612
deploy-docs:
1713
runs-on: ubuntu-latest
14+
permissions:
15+
deployments: write
16+
issues: write
17+
pull-requests: write
18+
statuses: write
1819
steps:
1920
- name: Dump GitHub context
2021
env:
2122
GITHUB_CONTEXT: ${{ toJson(github) }}
2223
run: echo "$GITHUB_CONTEXT"
23-
- uses: actions/checkout@v6
24+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
25+
with:
26+
persist-credentials: false
2427
- name: Set up Python
25-
uses: actions/setup-python@v6
28+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2629
with:
2730
python-version-file: ".python-version"
2831
- name: Setup uv
29-
uses: astral-sh/setup-uv@v7
32+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
3033
with:
31-
enable-cache: true
32-
cache-dependency-glob: |
33-
pyproject.toml
34-
uv.lock
34+
version: "0.11.4"
35+
enable-cache: false
3536
- name: Install GitHub Actions dependencies
3637
run: uv sync --locked --no-dev --group github-actions
3738
- name: Deploy Docs Status Pending
@@ -45,7 +46,7 @@ jobs:
4546
run: |
4647
rm -rf ./site
4748
mkdir ./site
48-
- uses: actions/download-artifact@v8
49+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
4950
with:
5051
path: ./site/
5152
pattern: docs-site-*
@@ -59,10 +60,10 @@ jobs:
5960
env:
6061
PROJECT_NAME: fastapitiangolo
6162
BRANCH: ${{ ( github.event.workflow_run.head_repository.full_name == github.repository && github.event.workflow_run.head_branch == 'master' && 'main' ) || ( github.event.workflow_run.head_sha ) }}
62-
uses: cloudflare/wrangler-action@v3
63+
uses: cloudflare/wrangler-action@9acf94ace14e7dc412b076f2c5c20b8ce93c79cd # v3.15.0
6364
with:
64-
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
65-
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
65+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} # zizmor: ignore[secrets-outside-env]
66+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} # zizmor: ignore[secrets-outside-env]
6667
command: pages deploy ./site --project-name=${{ env.PROJECT_NAME }} --branch=${{ env.BRANCH }}
6768
- name: Deploy Docs Status Error
6869
if: failure()

.github/workflows/detect-conflicts.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
name: "Conflict detector"
22
on:
33
push:
4-
pull_request_target:
4+
pull_request_target: # zizmor: ignore[dangerous-triggers]
55
types: [synchronize]
66

7+
permissions: {}
8+
79
jobs:
810
main:
911
permissions:
@@ -12,7 +14,7 @@ jobs:
1214
runs-on: ubuntu-latest
1315
steps:
1416
- name: Check if PRs have merge conflicts
15-
uses: eps1lon/actions-label-merge-conflict@v3
17+
uses: eps1lon/actions-label-merge-conflict@1df065ebe6e3310545d4f4c4e862e43bdca146f0 # v3.0.3
1618
with:
1719
dirtyLabel: "conflicts"
1820
repoToken: "${{ secrets.GITHUB_TOKEN }}"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Guard Dependencies
2+
3+
on:
4+
pull_request_target: # zizmor: ignore[dangerous-triggers] -- This workflow only reads context.payload metadata, never checks out PR code
5+
branches: [master]
6+
paths:
7+
- pyproject.toml
8+
- uv.lock
9+
10+
permissions:
11+
contents: read
12+
issues: write
13+
pull-requests: write
14+
15+
jobs:
16+
check-author:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Check if author is org member or allowed bot
20+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
21+
with:
22+
script: |
23+
const pr = context.payload.pull_request;
24+
const author = pr.user.login;
25+
const assoc = pr.author_association;
26+
27+
const botAllowlist = new Set(['dependabot[bot]']);
28+
const orgAuthorAssociations = new Set(['MEMBER', 'OWNER']);
29+
30+
const allowed =
31+
botAllowlist.has(author) ||
32+
(assoc != null && orgAuthorAssociations.has(assoc));
33+
34+
if (!allowed) {
35+
await github.rest.issues.createComment({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
issue_number: context.payload.pull_request.number,
39+
body: `This PR modifies dependency files (\`pyproject.toml\` or \`uv.lock\`), which is restricted to members of the **${context.repo.owner}** organization on GitHub.\n\nIf you need a dependency change, please [open a discussion](https://github.com/${context.repo.owner}/${context.repo.repo}/discussions/new) describing what you need and why.\n\nClosing this PR automatically.`
40+
});
41+
42+
await github.rest.pulls.update({
43+
owner: context.repo.owner,
44+
repo: context.repo.repo,
45+
pull_number: context.payload.pull_request.number,
46+
state: 'closed'
47+
});
48+
49+
core.setFailed('Dependency changes are restricted to organization members.');
50+
} else {
51+
console.log(`Author ${author} (author_association=${assoc}) is allowed to make dependency changes.`);
52+
}

0 commit comments

Comments
 (0)