Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions .github/workflows/update-doc-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Update doc DB

permissions:
contents: write
pull-requests: write

on:
workflow_dispatch:
Expand All @@ -10,10 +11,10 @@ on:
description: Target python version to generate doc db for
type: string
default: "3.14.3"
ref:
description: Branch to commit to (leave empty for current branch)
base-ref:
description: Base branch to create the update branch from
type: string
default: ""
default: "main"

defaults:
run:
Expand Down Expand Up @@ -56,9 +57,12 @@ jobs:
steps:
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v6.0.1
with:
ref: ${{ inputs.ref || github.ref }}
ref: ${{ inputs.base-ref }}
token: ${{ secrets.AUTO_COMMIT_PAT }}

- name: Create update branch
run: git switch -c update-doc-${{ inputs.python-version }}

- name: Download generated doc DBs
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
Expand Down Expand Up @@ -96,13 +100,18 @@ jobs:
retention-days: 7
overwrite: true

- name: Commit and push (non-main branches only)
if: github.ref != 'refs/heads/main' && inputs.ref != 'main'
- name: Commit, push and create PR
env:
GH_TOKEN: ${{ secrets.AUTO_COMMIT_PAT }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if [ -n "$(git status --porcelain)" ]; then
git add crates/doc/src/data.inc.rs
git commit -m "Update doc DB for CPython ${{ inputs.python-version }}"
git push
git push -u origin HEAD
gh pr create \
--base ${{ inputs.base-ref }} \
--title "Update doc DB for CPython ${{ inputs.python-version }}" \
--body "Auto-generated by update-doc-db workflow."
fi