Integration · no API key
Publish previews from GitHub Actions
Publish a preview from GitHub Actions with one workflow step: the anyshare CLI uploads the build, test report or coverage page, and the link lands in the pull request.
Workflow step
More ways to connectAfter your build step. -q prints only the URL, which goes into the step’s outputs. The API key keeps the link in your account.
- name: Publish to anyshare
id: anyshare
env:
ANYSHARE_API_KEY: ${{ secrets.ANYSHARE_API_KEY }}
run: |
url=$(npx -y @anyshare/cli ./dist -q)
echo "url=$url" >> "$GITHUB_OUTPUT"- No account to publish
- No API key
- Keep links 30 days with a free account
A recipe, not a marketplace Action
There’s no official anyshare Action on the GitHub Marketplace yet, and you don’t need one. The CLI runs with npx, needs no login to publish, and prints only the URL, so two plain run steps do the job: one publishes, one comments on the pull request.
Without an account a link expires after 1 hour, which is too short for a review. Run npx -y @anyshare/cli login once on your machine, copy the key it saves in ~/.config/anyshare/auth.json into a repository secret named ANYSHARE_API_KEY, and every preview lands in your free account and lasts 30 days.
Publish whatever a reviewer should click: dist/ for a static front end, playwright-report/ for a Playwright HTML report, coverage/lcov-report/ for a coverage page. Anything with an index.html becomes a website. The CLI skips .env and key files and warns if the folder looks like unbuilt source.
Reference
The complete workflow
A working workflow for npm projects, plus three variations. Change ./dist to your build folder.
preview.yml
Builds every pull request, publishes dist/ and comments the link.
# .github/workflows/preview.yml
name: Preview
on:
pull_request:
permissions:
contents: read
pull-requests: write
jobs:
preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npm run build
- name: Publish to anyshare
id: anyshare
env:
ANYSHARE_API_KEY: ${{ secrets.ANYSHARE_API_KEY }}
run: |
url=$(npx -y @anyshare/cli ./dist -q --title "PR #${{ github.event.pull_request.number }}")
echo "url=$url" >> "$GITHUB_OUTPUT"
- name: Comment the link
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr comment ${{ github.event.pull_request.number }} \
--repo "$GITHUB_REPOSITORY" \
--body "Preview: ${{ steps.anyshare.outputs.url }} (anyshare link, expires in 30 days)"Test report
if: always() publishes the report even when tests fail, which is when you need it most.
- name: Publish the Playwright report
if: always()
id: report
env:
ANYSHARE_API_KEY: ${{ secrets.ANYSHARE_API_KEY }}
run: |
url=$(npx -y @anyshare/cli ./playwright-report -q --title "Test report")
echo "url=$url" >> "$GITHUB_OUTPUT"Job summary
For pull requests from forks, where the token can’t comment.
- name: Add the link to the job summary
run: |
echo "Preview: ${{ steps.anyshare.outputs.url }}" >> "$GITHUB_STEP_SUMMARY"Stable link for main
In a workflow that runs on push. Publish once with --slug my-project-main --json, save the token as the ANYSHARE_TOKEN secret, then update.
- name: Update the main-branch preview
if: github.ref == 'refs/heads/main'
env:
ANYSHARE_TOKEN: ${{ secrets.ANYSHARE_TOKEN }}
run: npx -y @anyshare/cli update my-project-main ./distWhen it’s shared
What reviewers click
The comment links to a live copy of the build or report at its own subdomain, so reviewers open it in the browser instead of downloading an artifact and unzipping it.
- Front-end builds as websites
- Test and coverage reports as pages
- One link per pull request run
- Opens on any device
How it works
Three steps in your workflow
- Step 1:
Build
Check out the code, set up Node.js 20 or newer, and run your build as usual.
- Step 2:
Publish with the CLI
Run
npx -y @anyshare/cli ./dist -qand write the URL to$GITHUB_OUTPUTso later steps can use it. - Step 3:
Comment the link
gh pr commentposts it on the pull request, using the workflow’s own token. The job needspull-requests: write.
The details
Things to know
One secret, the API key
Publishing works without a key, but those links last 1 hour; the
ANYSHARE_API_KEYsecret makes them last 30 days. The comment step uses GitHub’s built-in token viaGH_TOKEN: ${{ github.token }}.Pull requests from forks
On
pull_requestevents from forks the token is read-only and secrets aren’t passed, so the comment step fails and the preview lasts 1 hour. Write the URL to the job summary instead, and avoidpull_request_targetfor building untrusted code.Links are public and temporary
Anyone with the URL can open the preview, it isn’t indexed by search engines, and it’s deleted when it expires (30 days with the API key, 1 hour without). Don’t publish reports that contain secrets or private data.
Keep tokens out of logs
-qprints only the URL.--jsonalso prints the update token, and logs of public repositories are public, so only use it where the output stays private.One link per run, or one stable link
The simplest setup publishes a fresh link on every push. For one stable link to
main, publish once from your machine while signed in, save the token as a secret, and runupdateon each push.Same limits as everywhere
50 MB and 1,000 files per upload. Builds with source maps or raw media are the usual reason to hit the size limit.
FAQ
Questions, answered.
Is there an official anyshare GitHub Action?
run steps, which works today and has nothing to install beyond Node.js.Does it need an API key or a repository secret?
ANYSHARE_API_KEY secret each preview expires after 1 hour. With it, previews go into your free account and last 30 days. The comment step uses the token GitHub gives every workflow, and updating one stable link needs the link’s token as a secret too.Why didn’t the comment appear on a pull request from a fork?
Can every push update the same link?
--json as an encrypted secret, and run update <slug> ./dist with ANYSHARE_TOKEN set. Otherwise each run gets a new link.Who can see the preview?
Give your agent a URL for any file.
One step to connect, no account or API key. It hands you back a link anyone can open, and a claim link to keep it.




