Skip to content

Commit 84ee065

Browse files
committed
Merge remote-tracking branch 'upstream/main' into public_url-option
2 parents 2153f5f + 04c12c2 commit 84ee065

36 files changed

Lines changed: 1409 additions & 518 deletions

.github/DISCUSSION_TEMPLATE/questions.yml

Lines changed: 0 additions & 118 deletions
This file was deleted.

.github/FUNDING.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/privileged.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,47 @@ updates:
44
- package-ecosystem: "github-actions"
55
directory: "/"
66
schedule:
7-
interval: "daily"
7+
interval: "weekly"
8+
cooldown:
9+
default-days: 7
810
commit-message:
911
prefix:
12+
labels:
13+
- "internal"
14+
- "dependencies"
15+
- "github_actions"
16+
groups:
17+
github-actions:
18+
patterns:
19+
- "*"
1020
# Python
1121
- package-ecosystem: "uv"
1222
directory: "/"
1323
schedule:
14-
interval: "daily"
24+
interval: "weekly"
25+
cooldown:
26+
default-days: 7
1527
commit-message:
1628
prefix:
29+
groups:
30+
python-packages:
31+
dependency-type: "development"
32+
patterns:
33+
- "*"
34+
# pre-commit
35+
- package-ecosystem: "pre-commit"
36+
directory: "/"
37+
schedule:
38+
interval: "weekly"
39+
cooldown:
40+
default-days: 7
41+
commit-message:
42+
prefix:
43+
labels:
44+
- "internal"
45+
- "dependencies"
46+
- "pre-commit"
47+
groups:
48+
pre-commit:
49+
patterns:
50+
- "*"
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
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
16+
timeout-minutes: 5
1417
steps:
15-
- uses: actions/add-to-project@244f685bbc3b7adfa8466e08b698b5577571133e # v1.0.2
18+
- uses: actions/add-to-project@5afcf98fcd03f1c2f92c3c83f58ae24323cc57fd # v2.0.0
1619
with:
1720
project-url: https://github.com/orgs/fastapi/projects/2
18-
github-token: ${{ secrets.PROJECTS_TOKEN }}
21+
github-token: ${{ secrets.PROJECTS_TOKEN }} # zizmor: ignore[secrets-outside-env]
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Create Draft Release
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
8+
permissions: {}
9+
10+
jobs:
11+
create-draft-release:
12+
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 5
15+
permissions:
16+
contents: write
17+
env:
18+
PREPARE_RELEASE_VERSION_FILE: src/fastapi_cli/__init__.py
19+
PREPARE_RELEASE_RELEASE_NOTES_FILE: release-notes.md
20+
steps:
21+
- name: Dump GitHub context
22+
env:
23+
GITHUB_CONTEXT: ${{ toJson(github) }}
24+
run: echo "$GITHUB_CONTEXT"
25+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
26+
with:
27+
ref: ${{ github.event.repository.default_branch }}
28+
persist-credentials: true
29+
- name: Set up Python
30+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
31+
with:
32+
python-version-file: ".python-version"
33+
- name: Install uv
34+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
35+
with:
36+
# Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
37+
# See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
38+
version: "0.11.4"
39+
- name: Extract release details
40+
id: release-details
41+
run: |
42+
set -euo pipefail
43+
version="$(uv run python scripts/prepare_release.py current-version)"
44+
uv run python scripts/prepare_release.py release-notes > draft-release-notes.md
45+
echo "version=$version" >> "$GITHUB_OUTPUT"
46+
- name: Create draft release
47+
env:
48+
GH_TOKEN: ${{ github.token }}
49+
VERSION: ${{ steps.release-details.outputs.version }}
50+
run: |
51+
set -euo pipefail
52+
gh release create "$VERSION" \
53+
--draft \
54+
--title "$VERSION" \
55+
--notes-file draft-release-notes.md \
56+
--target "$(git rev-parse HEAD)"

.github/workflows/detect-conflicts.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
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:
1012
contents: read
1113
pull-requests: write
1214
runs-on: ubuntu-latest
15+
timeout-minutes: 5
1316
steps:
1417
- name: Check if PRs have merge conflicts
15-
uses: eps1lon/actions-label-merge-conflict@1df065ebe6e3310545d4f4c4e862e43bdca146f0 # v3.0.3
18+
uses: eps1lon/actions-label-merge-conflict@0273be72a0bbd58fcd71d0d6c02c209b50d1e5e1 # v3.1.0
1619
with:
1720
dirtyLabel: "conflicts"
1821
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: [main]
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+
}

.github/workflows/issue-manager.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,22 @@ on:
99
issues:
1010
types:
1111
- labeled
12-
pull_request_target:
12+
pull_request_target: # zizmor: ignore[dangerous-triggers]
1313
types:
1414
- labeled
1515
workflow_dispatch:
1616

17-
permissions:
18-
issues: write
19-
pull-requests: write
17+
permissions: {}
18+
2019

2120
jobs:
2221
issue-manager:
2322
if: github.repository_owner == 'fastapi'
2423
runs-on: ubuntu-latest
24+
permissions:
25+
issues: write
26+
pull-requests: write
27+
timeout-minutes: 5
2528
steps:
2629
- name: Dump GitHub context
2730
env:

0 commit comments

Comments
 (0)