-
Notifications
You must be signed in to change notification settings - Fork 0
Tolerate previews of Workers that cannot have preview URLs #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,6 +43,10 @@ on: | |
| value: ${{ jobs.version.outputs.version-id }} | ||
| deployment-url: | ||
| value: ${{ jobs.version.outputs.deployment-url }} | ||
| # Non-empty only when a preview produced no preview URL (Durable Object | ||
| # Workers never get one) and deployment-url fell back to the target. | ||
| preview-note: | ||
| value: ${{ jobs.version.outputs.preview-note }} | ||
|
Comment on lines
+48
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The raw object for AGENTS.md reference: AGENTS.md:L52-L56 Useful? React with 👍 / 👎. |
||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
@@ -60,6 +64,7 @@ jobs: | |
| outputs: | ||
| version-id: ${{ steps.metadata.outputs.version-id }} | ||
| deployment-url: ${{ steps.metadata.outputs.deployment-url }} | ||
| preview-note: ${{ steps.metadata.outputs.preview-note }} | ||
| defaults: | ||
| run: | ||
| working-directory: ${{ fromJSON(inputs.quality-policy).workingDirectory }} | ||
|
|
@@ -237,21 +242,38 @@ jobs: | |
| run: | | ||
| VERSION_ID=$(printf '%s' "$COMMAND_OUTPUT" | grep -oE '(Worker )?Version ID: +[a-f0-9-]+' | head -1 | grep -oE '[a-f0-9-]{8,}' || true) | ||
| PREVIEW_URL=$(printf '%s' "$COMMAND_OUTPUT" | grep -oE 'https://[^[:space:]]+\.workers\.dev[^[:space:]]*' | head -1 || true) | ||
| PREVIEW_NOTE="" | ||
| if [ "$OPERATION" = "preview" ]; then | ||
| DEPLOYMENT_URL="${PREVIEW_URL:-$ACTION_URL}" | ||
| if [ -z "$DEPLOYMENT_URL" ]; then | ||
| # Cloudflare does not issue preview URLs for Workers that | ||
| # implement a Durable Object, Containers included — the upload | ||
| # succeeded and the version exists at 0% traffic, there is just | ||
| # no URL that serves it. Fall back to the target URL so the | ||
| # GitHub Environment and the PR comment point somewhere real, | ||
| # and carry a note so nobody mistakes it for the preview. | ||
| DEPLOYMENT_URL="$TARGET_URL" | ||
| PREVIEW_NOTE="no preview URL: Cloudflare does not generate them for Durable Object Workers; the version is uploaded at 0% traffic and the URL above is the live target" | ||
|
Comment on lines
+255
to
+256
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a Durable Object consumer runs AGENTS.md reference: AGENTS.md:L615-L628 Useful? React with 👍 / 👎. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
A preview can lack a URL simply because the consumer has AGENTS.md reference: AGENTS.md:L620-L624 Useful? React with 👍 / 👎. |
||
| fi | ||
| else | ||
| DEPLOYMENT_URL="${TARGET_URL:-$ACTION_URL}" | ||
| fi | ||
| if [ -z "$VERSION_ID" ] || [ -z "$DEPLOYMENT_URL" ]; then | ||
| echo "::error::Cloudflare output did not contain version metadata" | ||
| exit 1 | ||
| fi | ||
| echo "version-id=$VERSION_ID" >> "$GITHUB_OUTPUT" | ||
| echo "deployment-url=$DEPLOYMENT_URL" >> "$GITHUB_OUTPUT" | ||
| { | ||
| echo "version-id=$VERSION_ID" | ||
| echo "deployment-url=$DEPLOYMENT_URL" | ||
| echo "preview-note=$PREVIEW_NOTE" | ||
| } >> "$GITHUB_OUTPUT" | ||
| { | ||
| echo "### Cloudflare ${{ inputs.target }} ${{ inputs.operation }}" | ||
| echo "- Tag: \`${{ inputs.version-tag }}\`" | ||
| echo "- Version: \`$VERSION_ID\`" | ||
| echo "- URL: $DEPLOYMENT_URL" | ||
| if [ -n "$PREVIEW_NOTE" ]; then | ||
| echo "- Note: $PREVIEW_NOTE" | ||
| fi | ||
| echo "- Source: ${{ inputs.version-message }}" | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit combines the preview implementation and its regression test with repository-wide updates from v1.4.0 to
ffc9220f..., so the implementation and pin transition cannot be reviewed or reverted independently. Move theuses:and checkoutref:changes into the explicitly required separate pin-advance commit.AGENTS.md reference: AGENTS.md:L683-L688
Useful? React with 👍 / 👎.