From 6b9c498efdd77f0100f3d47ce33a3ed03b45c1ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Mon, 20 Oct 2025 20:47:14 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Add=20configs=20for=20.github?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/FUNDING.yml | 1 + .github/dependabot.yml | 16 ++++++++ .github/labeler.yml | 11 ++++++ .github/workflows/detect-conflicts.yml | 20 ++++++++++ .github/workflows/issue-manager.yml | 51 ++++++++++++++++++++++++++ .github/workflows/labeler.yml | 33 +++++++++++++++++ .github/workflows/latest-changes.yml | 44 ++++++++++++++++++++++ .github/workflows/publish.yml | 32 ++++++++++++++++ 8 files changed, 208 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 .github/dependabot.yml create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/detect-conflicts.yml create mode 100644 .github/workflows/issue-manager.yml create mode 100644 .github/workflows/labeler.yml create mode 100644 .github/workflows/latest-changes.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..0ffc101 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [tiangolo] diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..fdca003 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: + # GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + commit-message: + prefix: ⬆ + # Python + - package-ecosystem: "uv" + directory: "/" + schedule: + interval: "monthly" + commit-message: + prefix: ⬆ diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..6f5221e --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,11 @@ +internal: + - all: + - changed-files: + - any-glob-to-any-file: + - .github/** + - scripts/** + - .gitignore + - .pre-commit-config.yaml + - all-globs-to-all-files: + - '!src/**' + - '!pyproject.toml' diff --git a/.github/workflows/detect-conflicts.yml b/.github/workflows/detect-conflicts.yml new file mode 100644 index 0000000..b46c11e --- /dev/null +++ b/.github/workflows/detect-conflicts.yml @@ -0,0 +1,20 @@ +name: Conflict detector +on: + push: + pull_request_target: + types: + - synchronize + +jobs: + main: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - name: Check if PRs have merge conflicts + uses: eps1lon/actions-label-merge-conflict@v3 + with: + dirtyLabel: conflicts + repoToken: "${{ secrets.GITHUB_TOKEN }}" + commentOnDirty: This pull request has a merge conflict that needs to be resolved. diff --git a/.github/workflows/issue-manager.yml b/.github/workflows/issue-manager.yml new file mode 100644 index 0000000..b97ed6a --- /dev/null +++ b/.github/workflows/issue-manager.yml @@ -0,0 +1,51 @@ +name: Issue Manager + +on: + schedule: + - cron: "13 22 * * *" + issue_comment: + types: + - created + issues: + types: + - labeled + pull_request_target: + types: + - labeled + workflow_dispatch: + +permissions: + issues: write + pull-requests: write + +jobs: + issue-manager: + if: github.repository_owner == 'fastapi' + runs-on: ubuntu-latest + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: tiangolo/issue-manager@0.6.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + config: > + { + "answered": { + "delay": 864000, + "message": "Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs." + }, + "waiting": { + "delay": 2628000, + "message": "As this PR has been waiting for the original user for a while but seems to be inactive, it's now going to be closed. But if there's anyone interested, feel free to create a new PR.", + "reminder": { + "before": "P3D", + "message": "Heads-up: this will be closed in 3 days unless there's new activity." + } + }, + "invalid": { + "delay": 0, + "message": "This was marked as invalid and will be closed now. If this is an error, please provide additional details." + } + } diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000..7aeb448 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,33 @@ +name: Labels +on: + pull_request_target: + types: + - opened + - synchronize + - reopened + # For label-checker + - labeled + - unlabeled + +jobs: + labeler: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v6 + if: ${{ github.event.action != 'labeled' && github.event.action != 'unlabeled' }} + - run: echo "Done adding labels" + # Run this after labeler applied labels + check-labels: + needs: + - labeler + permissions: + pull-requests: read + runs-on: ubuntu-latest + steps: + - uses: docker://agilepathway/pull-request-label-checker:latest + with: + one_of: breaking,security,feature,bug,refactor,upgrade,docs,lang-all,internal + repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/latest-changes.yml b/.github/workflows/latest-changes.yml new file mode 100644 index 0000000..d4e64c7 --- /dev/null +++ b/.github/workflows/latest-changes.yml @@ -0,0 +1,44 @@ +name: Latest Changes + +on: + pull_request_target: + branches: + - master + types: + - closed + workflow_dispatch: + inputs: + number: + description: PR number + required: true + debug_enabled: + description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' + required: false + default: 'false' + +jobs: + latest-changes: + runs-on: ubuntu-latest + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v5 + with: + # To allow latest-changes to commit to the main branch + token: ${{ secrets.ANNOTATED_DOC_LATEST_CHANGES }} + # Allow debugging with tmate + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }} + with: + limit-access-to-actor: true + - uses: tiangolo/latest-changes@0.4.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + latest_changes_file: release-notes.md + latest_changes_header: '## Latest Changes' + end_regex: '^## ' + debug_logs: true + label_header_prefix: '### ' diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..173c45a --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,32 @@ +name: Publish + +on: + release: + types: + - created + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v5 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.10" + - name: Install build dependencies + run: pip install build + - name: Build distribution + run: python -m build + - name: Publish + uses: pypa/gh-action-pypi-publish@v1.13.0 + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT"