Skip to content

ci: comment a run-anywhere command to try the PR template artifact#491

Merged
MarioCadenas merged 6 commits into
mainfrom
feat/pr-template-try-comment
Jul 24, 2026
Merged

ci: comment a run-anywhere command to try the PR template artifact#491
MarioCadenas merged 6 commits into
mainfrom
feat/pr-template-try-comment

Conversation

@MarioCadenas

Copy link
Copy Markdown
Collaborator

What

Adds a sticky PR comment to the PR Template Artifact job that prints a self-contained, run-anywhere command to scaffold an app from this PR's SDK build:

gh run download <run-id> -R databricks/appkit -n appkit-template-<version> -D appkit-pr-<n> \
  && unzip -o "appkit-pr-<n>/appkit-template-<version>.zip" -d "appkit-pr-<n>" \
  && databricks apps init --template "appkit-pr-<n>"

Why

The job already builds a template with this PR's @databricks/appkit + @databricks/appkit-ui tarballs pinned via file: deps — but it lands in the artifacts UI with no obvious way to consume it. Testing meant hunting for the CI run, downloading the zip by hand, unzipping, and remembering the apps init invocation.

The requirement here was that the command be pasteable into any folder — not run from inside an appkit checkout. So the run id, repo, artifact name, and output dir are all interpolated from CI context at build time; there's no repo-local script to depend on.

How

  • New .github/scripts/upsert-template-artifact-comment.cjs — marker-based sticky-comment upsert, cloned from the existing bundle-size / breaking-change scripts.
  • Two steps appended to pr-template-artifact: one builds the comment body (template-artifact-comment.md), one upserts it via actions/github-script.
  • Job-level pull-requests: write (overrides the top-level read), matching the bundle-size job.

Additive only (86 lines, 2 files); no change to the artifact itself.

Notes / limitations

  • The command needs the GitHub CLI (gh auth login) since artifact download requires auth, and the Databricks CLI. Both are stated in the comment.
  • Fork PRs won't get pull-requests: write, so the comment step is skipped there — same behavior as the repo's other comment jobs.
  • Verified: YAML parses, biome clean on the .cjs, and the rendered comment markdown was simulated locally.

The PR Template Artifact job builds a scaffold with this PR's SDK tarballs
but leaves it in the artifacts UI with no obvious way to consume it. Add a
sticky PR comment that prints a self-contained command — gh run download of
this run's artifact, unzip, then databricks apps init --template — with the
run id, repo, artifact name, and output dir all baked in, so it can be pasted
into any folder without a repo checkout.

Reuses the existing github-script + marker-based upsert pattern (bundle-size,
breaking-change). Adds job-level pull-requests: write for the comment.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@MarioCadenas
MarioCadenas requested a review from a team as a code owner July 24, 2026 09:10
@MarioCadenas
MarioCadenas requested a review from calvarjorge July 24, 2026 09:10
Job-level permissions replace the top-level set rather than merging, so
adding pull-requests: write dropped the top-level id-token: write that
setup-jfrog-npm needs for its OIDC token (ACTIONS_ID_TOKEN_REQUEST_TOKEN
unbound). List all three at the job level.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
Fork PRs get a read-only GITHUB_TOKEN, so the github-script upsert would
403 and fail the whole pr-template-artifact job for an author who can't
fix it. Guard the comment step with the same head-repo check bundle-size.yml
and eval-pr-comment.yml already use.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@pkosiec
pkosiec requested review from pkosiec and removed request for calvarjorge July 24, 2026 09:54
@pkosiec

pkosiec commented Jul 24, 2026

Copy link
Copy Markdown
Member

@MarioCadenas quick question - is it another comment or are we merging with the existing one?
image

I'd vote to have just a single automated comment under PR to avoid bloat, especially that it's related - WDYT?

@MarioCadenas

Copy link
Copy Markdown
Collaborator Author

@MarioCadenas quick question - is it another comment or are we merging with the existing one? image

I'd vote to have just a single automated comment under PR to avoid bloat, especially that it's related - WDYT?

its not related at all and they run in completely different points in time AFAIK

@pkosiec pkosiec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved regardless of the suggestion to merge Evals comment with this

its not related at all and they run in completely different points in time AFAIK

we already discussed that with Mario offline, the template artifact is going to be used by the evals pipeline (currently it's not due to the limitations of the evals pipeline). The evals comment is posted right away but it should've wait for the artifact too, so it makes sense to merge them 👍

Combine the evals-monitor link and the try-this-template command into a
single sticky comment with two delimited sections instead of two separate
comments. Add a shared upsert-pr-comment-section.cjs helper: each workflow
owns one section id and rewrites only its block, preserving the other's
content (a push reruns the template section without wiping the eval link).

The two writers are separated in time — the eval link posts instantly on PR
open, the template command posts after the ~5-min build — so concurrent
writes to the shared comment don't occur. Bundle-size and breaking-change
comments are intentionally left separate for now.

Replaces the single-purpose upsert-template-artifact-comment.cjs and
rewires eval-pr-comment.yml onto the shared helper.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
Drop the separate Eval PR Comment workflow and the section-merge helper;
the pr-template-artifact job now posts a single comment containing both the
evals-monitor link and the run-anywhere template command. One writer, one
comment, plain marker-based upsert — no cross-workflow coordination.

Tradeoff: the eval link now rides the ~5-min build and is skipped on
docs-only PRs (where the artifact job doesn't run and evals are moot),
instead of posting instantly on every PR open.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

🤖 AppKit PR bot

🔬 Run evals

Start an eval for this PR from the evals-monitor app: Go to Evals Monitor →

📦 Try this PR's app template

Scaffolds a new app from this PR's SDK build. Run it in any folder (requires the GitHub CLI — gh auth login — and the Databricks CLI):

gh run download 30086700900 -R databricks/appkit -n appkit-template-0.47.1-pr.b13a16b-feat-pr-template-try-comment-491 -D appkit-pr-491 \
  && unzip -o "appkit-pr-491/appkit-template-0.47.1-pr.b13a16b-feat-pr-template-try-comment-491.zip" -d "appkit-pr-491" \
  && databricks apps init --template "appkit-pr-491"

The template pins @databricks/appkit and @databricks/appkit-ui to tarballs built from this branch, so the scaffolded app runs against this PR's code.

@databricks databricks deleted a comment from github-actions Bot Jul 24, 2026
@databricks databricks deleted a comment from github-actions Bot Jul 24, 2026
Add an overall '🤖 AppKit PR bot' header and a '### 🔬 Run evals' title so the
evals link matches the template section's heading instead of being a bare
blockquote.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@MarioCadenas
MarioCadenas merged commit 92cb8bb into main Jul 24, 2026
9 checks passed
@MarioCadenas
MarioCadenas deleted the feat/pr-template-try-comment branch July 24, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants