Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"plugins": [
{
"name": "visualci",
"version": "0.1.57",
"version": "0.1.59",
"description": "Visual regression and snapshot review for PDFs, screenshots, JSON, HTML and text: VisualCI's MCP server and its skills for each CI provider and test tool.",
"author": { "name": "DocSpring", "url": "https://visualci.com" },
"homepage": "https://visualci.com/docs/skills/",
Expand Down
2 changes: 1 addition & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "visualci",
"version": "0.1.57",
"version": "0.1.59",
"description": "Visual regression and snapshot review for PDFs, screenshots, JSON, HTML and text: VisualCI's MCP server and its skills for each CI provider and test tool.",
"author": { "name": "DocSpring", "url": "https://visualci.com" },
"homepage": "https://visualci.com/docs/skills/",
Expand Down
2 changes: 1 addition & 1 deletion .cursor-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "visualci",
"displayName": "VisualCI",
"version": "0.1.57",
"version": "0.1.59",
"description": "Visual regression and snapshot review for PDFs, screenshots, JSON, HTML and text: VisualCI's MCP server and its skills for each CI provider and test tool.",
"author": {
"name": "DocSpring"
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,44 @@ jobs:
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
# The GitHub Action (sc-9246): with no token and no VISUALCI_TOKEN it fails, so a missing or misnamed secret
# can't pass quietly; with VISUALCI_TOKEN only in env, every CLI call gets it. It skips fork and Dependabot
# runs, so these checks run only on this repository's own.
- id: no-token
if: github.actor != 'dependabot[bot]' && !github.event.repository.fork && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
uses: ./clients/github-action
continue-on-error: true
- if: github.actor != 'dependabot[bot]' && !github.event.repository.fork && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
env:
OUTCOME: ${{ steps.no-token.outcome }}
SKIPPED: ${{ steps.no-token.outputs.skipped }}
run: |
if [ "$OUTCOME" != failure ] || [ -n "$SKIPPED" ]; then
echo "::error::the action without a token should fail at its token step (outcome $OUTCOME, skipped '$SKIPPED')"
exit 1
fi
# A stub CLI that records the token each call gets.
cat > "$RUNNER_TEMP/visualci-stub" <<'STUB'
#!/bin/sh
echo "$1 $VISUALCI_TOKEN" >> "$RUNNER_TEMP/visualci-stub.log"
[ "$1" = build ] && [ "$2" = create ] && echo 1
exit 0
STUB
- id: env-token
if: github.actor != 'dependabot[bot]' && !github.event.repository.fork && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
uses: ./clients/github-action
env:
VISUALCI_TOKEN: env-only-token
with:
cli: ${{ runner.temp }}/visualci-stub
upload: some/dir
- if: github.actor != 'dependabot[bot]' && !github.event.repository.fork && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
env:
SKIPPED: ${{ steps.env-token.outputs.skipped }}
run: |
cat "$RUNNER_TEMP/visualci-stub.log"
[ "$SKIPPED" = false ] || { echo "::error::skipped with VISUALCI_TOKEN in env ($SKIPPED)"; exit 1; }
[ "$(grep -c ' env-only-token$' "$RUNNER_TEMP/visualci-stub.log")" = 3 ] || { echo "::error::not every CLI call got the env token"; exit 1; }
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
Expand Down
39 changes: 29 additions & 10 deletions clients/github-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ branding:
inputs:
token:
description: >
A VisualCI project token (secrets.VISUALCI_TOKEN). Empty on pull requests from forks, which are skipped with a
notice; send theirs from a workflow_run workflow instead (visualci.com/docs/ci/github-actions/#pull-requests-from-forks).
A VisualCI project token (secrets.VISUALCI_TOKEN). Left out, the action reads VISUALCI_TOKEN from the workflow's
or job's env. With neither, the step fails, except where GitHub passes no repository secrets (a fork's pull
request, a run in a fork, Dependabot's pull requests), which are skipped with a notice; send theirs from a workflow_run workflow instead
(visualci.com/docs/ci/github-actions/#pull-requests-from-forks).
required: false
default: ""
upload:
Expand Down Expand Up @@ -66,7 +68,7 @@ outputs:
description: The build's id (empty when skipped).
value: ${{ steps.build.outputs.id }}
skipped:
description: true when there was no token (a fork's pull request).
description: true when VisualCI was skipped for lack of secrets (a fork's pull request, a run in a fork, or Dependabot's).
value: ${{ steps.token.outputs.skipped }}

runs:
Expand All @@ -75,13 +77,30 @@ runs:
- id: token
shell: bash
env:
TOKEN: ${{ inputs.token }}
TOKEN: ${{ inputs.token || env.VISUALCI_TOKEN }}
EVENT: ${{ github.event_name }}
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
REPO: ${{ github.repository }}
ACTOR: ${{ github.actor }}
IS_FORK: ${{ github.event.repository.fork }}
run: |
if [ -z "$TOKEN" ]; then
echo "::notice title=VisualCI skipped::No VisualCI token (secrets aren't passed to pull requests from forks)."
# Skipped only where GitHub passes no repository secrets: a fork's pull request (its head repository differs,
# or was deleted), a run in a fork itself, and Dependabot's own events (Dependabot secrets only). Everywhere
# else, pull_request_target and workflow_run included, a missing token is a mistake and fails.
if [ -n "$TOKEN" ]; then
echo "skipped=false" >> "$GITHUB_OUTPUT"
elif [ "$IS_FORK" = true ]; then
echo "::notice title=VisualCI skipped::No VisualCI token: this workflow runs in a fork, which has no VisualCI token. Its pull request is sent from the upstream repository."
echo "skipped=true" >> "$GITHUB_OUTPUT"
elif [ "$EVENT" = pull_request ] && [ "$HEAD_REPO" != "$REPO" ]; then
echo "::notice title=VisualCI skipped::No VisualCI token: GitHub passes no secrets to a pull request from a fork. Send its snapshots from a workflow_run workflow: https://visualci.com/docs/ci/github-actions/#pull-requests-from-forks"
echo "skipped=true" >> "$GITHUB_OUTPUT"
elif [ "$ACTOR" = "dependabot[bot]" ] && [ "$EVENT" != workflow_run ] && [ "$EVENT" != pull_request_target ]; then
echo "::notice title=VisualCI skipped::No VisualCI token: Dependabot's runs get only Dependabot secrets. Add VISUALCI_TOKEN to the repository's Dependabot secrets to review its pull requests too."
echo "skipped=true" >> "$GITHUB_OUTPUT"
else
echo "skipped=false" >> "$GITHUB_OUTPUT"
echo "::error title=No VisualCI token::Pass the project token as the action's token input (the VISUALCI_TOKEN secret) or set VISUALCI_TOKEN in the job's env. If the secret is set, check its name and that this workflow can read it."
exit 1
fi

# In a workflow_run workflow (a fork's pull request, sent with secrets afterwards), the build belongs to the
Expand Down Expand Up @@ -156,7 +175,7 @@ runs:
if: steps.token.outputs.skipped == 'false'
shell: bash
env:
VISUALCI_TOKEN: ${{ inputs.token }}
VISUALCI_TOKEN: ${{ inputs.token || env.VISUALCI_TOKEN }}
VISUALCI_API_URL: ${{ inputs.api-url }}
NAME: ${{ inputs.name }}
run: |
Expand All @@ -167,7 +186,7 @@ runs:
- if: steps.token.outputs.skipped == 'false' && inputs.finalize-only != 'true'
shell: bash
env:
VISUALCI_TOKEN: ${{ inputs.token }}
VISUALCI_TOKEN: ${{ inputs.token || env.VISUALCI_TOKEN }}
VISUALCI_API_URL: ${{ inputs.api-url }}
VISUALCI_BUILD_ID: ${{ steps.build.outputs.id }}
UPLOAD: ${{ inputs.upload }}
Expand All @@ -192,7 +211,7 @@ runs:
- if: steps.token.outputs.skipped == 'false' && (inputs.finalize == 'true' || inputs.finalize-only == 'true')
shell: bash
env:
VISUALCI_TOKEN: ${{ inputs.token }}
VISUALCI_TOKEN: ${{ inputs.token || env.VISUALCI_TOKEN }}
VISUALCI_API_URL: ${{ inputs.api-url }}
VISUALCI_BUILD_ID: ${{ steps.build.outputs.id }}
WAIT: ${{ inputs.wait }}
Expand Down
4 changes: 2 additions & 2 deletions frontend/content/docs/ci/github-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ jobs:
screenshots --platform chromium-linux --threshold 0.1
```

The action installs the CLI, creates the build, uploads and finalizes it. `upload` takes one `visualci upload` per line, as its arguments (paths, `--from`, `--prefix`, `--platform`, `--format`); leave it out to send the `uploads` in [visualci.yml](/docs/reference/config/). Pull requests from forks get no secrets, so the action skips them with a notice; [send theirs from a second workflow](#pull-requests-from-forks).
The action installs the CLI, creates the build, uploads and finalizes it. `upload` takes one `visualci upload` per line, as its arguments (paths, `--from`, `--prefix`, `--platform`, `--format`); leave it out to send the `uploads` in [visualci.yml](/docs/reference/config/). Without a token the step fails, so a misnamed secret can't pass quietly. The token comes from `token`, or from `VISUALCI_TOKEN` in the workflow's or job's `env`. The exceptions are where GitHub passes no repository secrets: a fork's pull request and runs in a fork get none, and Dependabot's pull requests get only Dependabot secrets. The action skips those with a notice; [send a fork's from a second workflow](#pull-requests-from-forks), and add `VISUALCI_TOKEN` to the Dependabot secrets to review Dependabot's.

| Input | What it does |
| --- | --- |
| `token` | The project token. Empty skips VisualCI with a notice. |
| `token` | The project token, else `VISUALCI_TOKEN` from `env`. With neither, the step fails (see above for the runs it skips). |
| `upload` | What to send, one `visualci upload` argument line per line. |
| `name` | The build's name, one per suite, each with its own GitHub check. Default `default`. |
| `wait` | Wait for the result, and fail the step when the project's CI mode says CI should fail. |
Expand Down
2 changes: 1 addition & 1 deletion gemini-extension.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "visualci",
"version": "0.1.57",
"version": "0.1.59",
"description": "Visual regression and snapshot review for PDFs, screenshots, JSON, HTML and text: VisualCI's MCP server and its skills for each CI provider and test tool.",
"mcpServers": {
"visualci": {
Expand Down
4 changes: 2 additions & 2 deletions skills/visualci-github-actions/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ jobs:
screenshots --platform chromium-linux --threshold 0.1
```

The action installs the CLI, creates the build, uploads and finalizes it. `upload` takes one `visualci upload` per line, as its arguments (paths, `--from`, `--prefix`, `--platform`, `--format`); leave it out to send the `uploads` in [visualci.yml](https://visualci.com/docs/reference/config.md). Pull requests from forks get no secrets, so the action skips them with a notice; [send theirs from a second workflow](#pull-requests-from-forks).
The action installs the CLI, creates the build, uploads and finalizes it. `upload` takes one `visualci upload` per line, as its arguments (paths, `--from`, `--prefix`, `--platform`, `--format`); leave it out to send the `uploads` in [visualci.yml](https://visualci.com/docs/reference/config.md). Without a token the step fails, so a misnamed secret can't pass quietly. The token comes from `token`, or from `VISUALCI_TOKEN` in the workflow's or job's `env`. The exceptions are where GitHub passes no repository secrets: a fork's pull request and runs in a fork get none, and Dependabot's pull requests get only Dependabot secrets. The action skips those with a notice; [send a fork's from a second workflow](#pull-requests-from-forks), and add `VISUALCI_TOKEN` to the Dependabot secrets to review Dependabot's.

| Input | What it does |
| --- | --- |
| `token` | The project token. Empty skips VisualCI with a notice. |
| `token` | The project token, else `VISUALCI_TOKEN` from `env`. With neither, the step fails (see above for the runs it skips). |
| `upload` | What to send, one `visualci upload` argument line per line. |
| `name` | The build's name, one per suite, each with its own GitHub check. Default `default`. |
| `wait` | Wait for the result, and fail the step when the project's CI mode says CI should fail. |
Expand Down
Loading