Workflows

Continuous integration

CI mode runs the checks designed to be deterministic in an isolated pipeline and returns a non-zero exit status when reportable findings fail.

Basic release gate

php artisan larabeacon --ci --details

Run the command after dependencies and application configuration are available. Keep it next to tests, static analysis, and the production asset build.

GitHub Action with code scanning

The LaraBeacon action runs the CI profile, writes a SARIF report, uploads it to GitHub code scanning, and then applies the scan result to the job. Findings appear as annotations in pull requests and in the repository's Security tab.

permissions:
  contents: read
  security-events: write

steps:
  - uses: actions/checkout@v7
  - uses: shivammathur/setup-php@v2
    with:
      php-version: '8.4'
  - run: composer install --no-interaction --prefer-dist
  - run: cp .env.example .env && php artisan key:generate
  - uses: A-Baer/LaraBeacon@v3
    with:
      fail-on: major
      baseline: larabeacon-baseline.json

Inputs: working-directory, profile (default ci), fail-on (default major), baseline, sarif-file, upload-sarif (default true), args for further options, and report, cloud-username, cloud-api-token and cloud-endpoint for Cloud reports. With a baseline, only new findings fail the job. args is split on whitespace and sarif-file must be relative. Code scanning resolves file paths from the repository root, so annotations are exact when the Laravel application lives at the root. Set upload-sarif: false if code scanning is not available for the repository; private repository support depends on plan and Code Security entitlement.

LaraBeacon Pro and Cloud in GitHub Actions

Pro is installed by your own composer install step, so CI needs the project credential from LaraBeacon Cloud. Store the project username and API token as repository secrets, for example LARABEACON_USERNAME and LARABEACON_TOKEN. The same credential downloads Pro and, while Cloud access is active, submits reports.

permissions:
  contents: read
  security-events: write

steps:
  - uses: actions/checkout@v7
  - uses: shivammathur/setup-php@v2
    with:
      php-version: '8.4'
  - run: composer install --no-interaction --prefer-dist
    env:
      COMPOSER_AUTH: '{"http-basic":{"larabeacon.com":{"username":"${{ secrets.LARABEACON_USERNAME }}","password":"${{ secrets.LARABEACON_TOKEN }}"}}}'
  - run: cp .env.example .env && php artisan key:generate
  - uses: A-Baer/LaraBeacon@v3
    with:
      fail-on: major
      baseline: larabeacon-baseline.json
      report: true
      cloud-username: ${{ secrets.LARABEACON_USERNAME }}
      cloud-api-token: ${{ secrets.LARABEACON_TOKEN }}

With report: true the action submits the run with the commit and branch, so Cloud compares it with the previous report of the same branch. Pull requests report their head commit and source branch. When the credentials are empty, for example in pull requests from forks, which receive no secrets, the scan still runs and the upload is skipped with a warning. Fork pull requests also cannot download Pro; install it in a separate job or make the step conditional if your project accepts contributions from forks. A rejected or failed upload, for example after Cloud access has ended, fails the step after the SARIF report has been written, with the same exit-code 1 as blocking findings. Do not cache the configuration before the action when report is enabled, because the action passes the Cloud credentials as environment variables.

CI mode skips the Pro checks that need a running environment, such as Telescope query analysis, Redis, Horizon and HTTP headers. Report them from a production-like environment, for example after a deployment, with php artisan larabeacon --profile=production --report.

Manual GitHub Actions step

- name: Run LaraBeacon
  env:
    APP_ENV: testing
    APP_KEY: base64:your-ci-key
  run: php artisan larabeacon --ci --details
Do not commit real secrets

Use the secret store of your CI provider for credentials. The example key is a placeholder and must not be reused.

Runtime stage

HTTP headers, production caches, queue workers, Redis, filesystem capacity, Telescope evidence, and similar signals need a representative environment. Run them against a release candidate before the final traffic switch, not against a synthetic CI container that cannot satisfy their assumptions.

Gate new findings

Finding-level JSON baselines and structured reports require LaraBeacon Core 3.1.0 or newer.

php artisan larabeacon:baseline --profile=ci \
  --output=larabeacon-baseline.json \
  --reason="Scheduled remediation" --expires=2026-12-31
php artisan larabeacon --profile=ci \
  --baseline=larabeacon-baseline.json --only-new --fail-on=major \
  --format=sarif --output=larabeacon.sarif

Review and commit each acceptance with its reason and optional expiry. Known findings stay in the report. Expired entries block again, and reportable execution errors always block. Loading a baseline without --only-new keeps the normal gate. Invalid options or baseline data return exit code 2.

Regenerating a JSON baseline preserves existing reasons and expiry dates. It removes resolved entries only for checks that completed, retaining entries for skipped or excluded checks. Review the baseline diff; do not regenerate it automatically in CI.

Upload the SARIF file as a CI artifact with an always() condition so failed gates retain their report. GitHub Code Scanning can consume it when enabled for the repository; private repository availability depends on plan and Code Security entitlement.

Baseline policy

  • Review every new finding before adding it to a baseline.
  • Keep baseline changes in the same pull request as the responsible code or architecture decision.
  • Prefer narrow analyzer exclusions over disabling an entire category.
  • Regenerate the baseline periodically so deleted code does not leave stale entries behind.