Skip to content

chore(ci): add per-PR Azion preview deploy workflow - #2309

Closed
marcus-souza-azion wants to merge 1 commit into
mainfrom
chore/pr-preview-deploys
Closed

chore(ci): add per-PR Azion preview deploy workflow#2309
marcus-souza-azion wants to merge 1 commit into
mainfrom
chore/pr-preview-deploys

Conversation

@marcus-souza-azion

Copy link
Copy Markdown
Contributor

What & why

Deploys every pull request to its own Azion workload and comments the URL on the PR.

Reviewers currently judge documentation changes from an MDX diff. This gives them the rendered page. Previews are the lowest-risk place to change that, because a broken preview is invisible to readers.

Related issue: none
Pages affected: none. Adds .github/workflows/pr-preview.yml and two .gitignore entries.

Type of change

  • 🆕 New content (feat)
  • 🩹 Fix (fix) — typo, broken link, wrong information
  • ♻️ Content update (docs) — rewrite, expansion, upkeep
  • 🌐 Translation sync (i18n)
  • 🏗️ Platform / structure (refactor / chore) — reviewed by UXE, no content mixed in

Author checklist

  • PR title follows type(scope): summary
  • Frontmatter complete (N/A: no published pages)
  • No legacy "edge-" product names in the copy
  • How-to/tutorial content includes a runnable code block (N/A: no published pages)
  • Screenshots have alt text (N/A: no images)
  • Internal links resolve
  • No permalink changed and no page moved, so no redirect is needed
  • i18n (N/A: CI configuration, not published content)
  • YAML validated locally

@marcus-souza-azion
marcus-souza-azion force-pushed the chore/pr-preview-deploys branch 2 times, most recently from e47743a to 03e1c63 Compare August 5, 2026 23:22
Deploys each pull request to its own Azion workload, named
docs-preview-pr-<number>, and comments the URL on the PR. Two open PRs never
share a URL because they never share a workload. `azion link --name` sets the
application name, so no config templating is involved.

Uses `azion deploy --local`: the remote builder runs out of memory above a 4 GB
heap and this site needs more, so the runner does the build and uploads the
result.

Adds azion/ and .edge/ to .gitignore. This is load-bearing rather than hygiene:
azion/azion.json holds the application and workload IDs the working copy is
linked to, and committing it would make every PR deploy into the same workload
and overwrite the others.

Two things learned from running this against CLI 4.22.2, both reflected here:

  - Deploy runs without --format json and without --out. Those flags swallow
    every error: a failing deploy writes `{"error": {}}` and nothing else,
    while plain output prints the real message. `list` keeps --format json
    because reads are unaffected, which is why the URL is resolved from a
    workload lookup rather than the deploy output.
  - The preset is spelled Astro, matching the value the CLI shows in its own
    picker, rather than lowercase.

A step after link dumps the working directory, azion/, azion.json,
azion.config.*, and .edge/. Deploy fails in about two seconds with "Failed to
open the azion.json file" when no config is present, so seeing what link
actually produced is the difference between a diagnosable run and a mystery.

Deliberate limits for this first version, all commented in the file:

  - Fork PRs skip instead of failing. They receive no secrets, so there is no
    token to deploy with.
  - Draft PRs skip. Marking one ready for review triggers the preview.
  - A paths filter keeps docs-only and config-only PRs from paying for a build.
    This workflow file is in that filter so changes to the preview can be
    tested by the PR that makes them.

Teardown on PR close is a separate workflow, not in this commit. It needs
pull_request_target to get a token on a closed fork PR, and it has to resolve
the workload name to an ID first, because `azion delete workload` takes
--workload-id rather than a name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant