Skip to content

Commit 60b0015

Browse files
refactor: use marketplace action for workflow dispatch
Replace gh workflow run with the-actions-org/workflow-dispatch@v4 marketplace action. This provides cleaner workflow URL output and eliminates the need for sleep + query logic. Benefits: - Direct workflow-url output from the action - No race conditions from querying recent runs - Cleaner, more maintainable code - Purpose-built for workflow_dispatch events Co-Authored-By: AJ Steers <[email protected]>
1 parent cdd2eec commit 60b0015

File tree

1 file changed

+16
-37
lines changed

1 file changed

+16
-37
lines changed

.github/workflows/prerelease-command.yml

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -80,42 +80,21 @@ jobs:
8080
8181
- name: Trigger publish workflow
8282
id: trigger-publish
83-
run: |
84-
# Trigger the publish workflow on the PR's head branch
85-
# Note: These defaults mirror the defaults in publish.yml and can be extended
86-
# to accept optional overrides via slash command arguments if needed in the future.
87-
gh workflow run publish.yml \
88-
--ref "${{ steps.pr-info.outputs.head-ref }}" \
89-
-f version="" \
90-
-f publish_to_pypi=true \
91-
-f publish_to_dockerhub=true \
92-
-f publish_manifest_server=true \
93-
-f update_connector_builder=false
94-
env:
95-
GH_TOKEN: ${{ steps.get-app-token.outputs.token }}
96-
97-
- name: Get workflow run URL
98-
id: workflow-url
99-
run: |
100-
# Wait a moment for the workflow to be created
101-
sleep 5
102-
# Query for the most recent publish workflow run on the PR branch
103-
# Filter by branch to avoid race conditions with concurrent runs
104-
WORKFLOW_RUN_URL=$(gh run list \
105-
--workflow=publish.yml \
106-
--branch "${{ steps.pr-info.outputs.head-ref }}" \
107-
--limit=1 \
108-
--json url \
109-
--jq '.[0].url')
110-
111-
if [ -z "$WORKFLOW_RUN_URL" ] || [ "$WORKFLOW_RUN_URL" = "null" ]; then
112-
echo "Warning: Could not find workflow run URL. Using fallback."
113-
WORKFLOW_RUN_URL="https://github.com/${{ github.repository }}/actions/workflows/publish.yml"
114-
fi
115-
116-
echo "workflow-run-url=${WORKFLOW_RUN_URL}" >> $GITHUB_OUTPUT
117-
env:
118-
GH_TOKEN: ${{ steps.get-app-token.outputs.token }}
83+
uses: the-actions-org/workflow-dispatch@v4
84+
with:
85+
workflow: publish.yml
86+
token: ${{ steps.get-app-token.outputs.token }}
87+
ref: ${{ steps.pr-info.outputs.head-ref }}
88+
wait-for-completion: false
89+
display-workflow-run-url: false
90+
inputs: >-
91+
{
92+
"version": "",
93+
"publish_to_pypi": "true",
94+
"publish_to_dockerhub": "true",
95+
"publish_manifest_server": "true",
96+
"update_connector_builder": "false"
97+
}
11998
12099
- name: Append success comment
121100
if: github.event.inputs.comment-id
@@ -126,7 +105,7 @@ jobs:
126105
body: |
127106
> ✅ Prerelease workflow triggered successfully.
128107
>
129-
> View the publish workflow run: ${{ steps.workflow-url.outputs.workflow-run-url }}
108+
> View the publish workflow run: ${{ steps.trigger-publish.outputs.workflow-url }}
130109
131110
- name: Append failure comment
132111
if: failure() && github.event.inputs.comment-id

0 commit comments

Comments
 (0)