diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index b22b854da..238bc4db4 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -5,6 +5,15 @@ on: push: tags: - "v*" + # Manual trigger for republishing a specific tag if the original push-on-tag + # run failed and is now too old to be re-run via the GitHub UI (#1790). + # ``ref`` should be a tag name like ``v4.11.1``. + workflow_dispatch: + inputs: + ref: + description: "Tag to republish (e.g., v4.11.1)" + required: true + type: string jobs: deploy: @@ -14,10 +23,19 @@ jobs: id-token: write contents: read steps: + - name: Validate dispatch ref is a tag + if: github.event_name == 'workflow_dispatch' + env: + TAG: ${{ github.event.inputs.ref }} + run: | + if ! git ls-remote --tags "https://github.com/${GITHUB_REPOSITORY}" "refs/tags/${TAG}" | grep -q .; then + echo "::error::Dispatch ref '${TAG}' is not an existing tag" + exit 1 + fi - uses: actions/checkout@v6 with: fetch-depth: 0 - ref: ${{ github.ref_name }} + ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', github.event.inputs.ref) || github.ref }} - name: Set up Python uses: astral-sh/setup-uv@v7 - name: Build