geo-scorev1.8.3
  1. geo-score
  2. Docs
  3. GitHub Action

Run geo-score in GitHub Actions

The geo-score Action runs the level 1 score in a workflow, writes a job summary with every check, and can fail the build when the score drops below a threshold or a gate reaches zero. It is a composite action defined in action.yml, and it passes every input to the scorer through environment variables, never through the shell.

How do I add geo-score to a workflow?

name: AI visibility
on: [push]
jobs:
  geo-score:
    runs-on: ubuntu-latest
    steps:
      - uses: jianruntech/geo-score@v1
        with:
          url: https://example.com
          fail-under: 40
          fail-on-gate: true

A gate at zero caps the score at 40, so a site that would otherwise score 40 or more reads exactly 40 and still passes fail-under: 40. fail-on-gate: true fails any capped site. In CI, keep fail-under at least five points below your usual score: one site's score moves by about ±5 between runs as the page sample changes.

Which inputs does the Action take?

InputDefaultWhat it does
urlrequiredThe URL to score.
fail-undernoneFail the job when the normalised score is below this.
fail-on-gatefalseFail the job when any gate check scores zero.
assertnonePer-check assertions, one per line, such as g.robots=max.
sample8How many pages to sample.
json-outnoneWrite the JSON report to this path.
urls-fromnoneScore the pages an earlier JSON report sampled.
baselinenoneCompare with an earlier report on the same pages and add a "Changes since baseline" section.
sarifnoneWrite SARIF 2.1.0 for code scanning.
junitnoneWrite JUnit XML for test-report tools.
annotationstrueAnnotate the run with checks at zero (gates as errors, others as warnings).
badgenoneWrite a badge: a path ending in .json gets shields.io endpoint JSON, any other path an SVG.

What does the Action output?

score (0–100), band, gate-capped, report (the full JSON), report-path and badge-path. With a baseline it also sets delta, the score minus the baseline's, and dropped-checks, the checks that lost points or reached zero, comma-separated in rubric order.

How do I fail only on a regression?

Commit a report as the baseline, score the same pages on each push, and fail when a check dropped. Pass the output to the shell through env, as the Action itself does with its inputs.

- id: geo
  uses: jianruntech/geo-score@v1
  with:
    url: https://example.com
    baseline: geo-score-baseline.json
- if: steps.geo.outputs.dropped-checks != ''
  env:
    DROPPED: ${{ steps.geo.outputs.dropped-checks }}
  run: |
    echo "::error title=geo-score::checks that dropped since the baseline: $DROPPED"
    exit 1

Re-scoring the baseline's pages takes sampling out of the comparison, so a difference comes from the site.

Can the Action track citations every week?

Not by itself: citations are level 3, which needs your provider keys and a fixed question list. The repository ships a scheduled workflow, examples/ci/watch-weekly.yml, that reads keys from repository secrets and commits each run, so the history lives in git. Run files contain your questions and the full answers, so keep them in a private repository if they are confidential.