Skip to content

Commit 0bb0656

Browse files
ci(pythonpublish): add workflow_dispatch trigger for republishing tags (#1981)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d82e029 commit 0bb0656

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

.github/workflows/pythonpublish.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ on:
55
push:
66
tags:
77
- "v*"
8+
# Manual trigger for republishing a specific tag if the original push-on-tag
9+
# run failed and is now too old to be re-run via the GitHub UI (#1790).
10+
# ``ref`` should be a tag name like ``v4.11.1``.
11+
workflow_dispatch:
12+
inputs:
13+
ref:
14+
description: "Tag to republish (e.g., v4.11.1)"
15+
required: true
16+
type: string
817

918
jobs:
1019
deploy:
@@ -14,10 +23,19 @@ jobs:
1423
id-token: write
1524
contents: read
1625
steps:
26+
- name: Validate dispatch ref is a tag
27+
if: github.event_name == 'workflow_dispatch'
28+
env:
29+
TAG: ${{ github.event.inputs.ref }}
30+
run: |
31+
if ! git ls-remote --tags "https://github.com/${GITHUB_REPOSITORY}" "refs/tags/${TAG}" | grep -q .; then
32+
echo "::error::Dispatch ref '${TAG}' is not an existing tag"
33+
exit 1
34+
fi
1735
- uses: actions/checkout@v6
1836
with:
1937
fetch-depth: 0
20-
ref: ${{ github.ref_name }}
38+
ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', github.event.inputs.ref) || github.ref }}
2139
- name: Set up Python
2240
uses: astral-sh/setup-uv@v7
2341
- name: Build

0 commit comments

Comments
 (0)