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
34 changes: 34 additions & 0 deletions docs/product/size-analysis/integrating-into-ci.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,40 @@ Clicking on the "Details" button above should bring you to a more detailed break

![Example Status Check](./images/status-check.png)

## Skip the Status Check When No Build Is Uploaded

Your team may require a Size Analysis check on every pull request, even when some CI workflows don't produce a build artifact. For example, a pull request that changes only documentation or other files that don't affect the app binary may not need a new build. In these cases, use the [skip endpoint](/api/mobile-builds/create-a-skipped-size-analysis-status-check/) to create a neutral check for the pull request's head commit so that it can merge without an unnecessary build.

<Alert level="warning">
The upload and skip paths should be mutually exclusive. Each workflow should
either upload a build or mark the check as skipped.
</Alert>

The example below assumes an earlier path-filtering step with an ID of `changes` sets a `should_upload` output. Use the same condition for your upload step and the inverse condition for the skip step so that only one runs. Reuse the `SENTRY_AUTH_TOKEN` configured for uploads and store it as an [encrypted GitHub Actions secret](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions).

```yml {filename:skip_status_checks_example.yml}
- name: Mark Size Analysis as skipped
if: github.event_name == 'pull_request' && steps.changes.outputs.should_upload == 'false'
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
jq -n \
--arg sha "$HEAD_SHA" \
--arg repository "$GITHUB_REPOSITORY" \
'{sha: $sha, repository: $repository, provider: "github"}' |
curl --fail-with-body \
--request POST \
--header "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
--header "Content-Type: application/json" \
--data-binary @- \
"https://sentry.io/api/0/projects/$SENTRY_ORG/$SENTRY_PROJECT/preprod/size-analysis/status-checks/skip/"
```

This example is configured for GitHub.com. For GitHub Enterprise, set `provider` to `github_enterprise`.

## Configuring Status Check Rules

By default, status checks appear as neutral and won't block pull requests. You can configure rules to automatically fail status checks when size thresholds are exceeded.
Expand Down
34 changes: 34 additions & 0 deletions docs/product/snapshots/integrating-into-ci.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,40 @@ After configuring the workflow, a **Snapshot Testing** status check will appear

For details on the review and approval flow, see [Reviewing Snapshots](/product/snapshots/reviewing-snapshots/).

## Skip the Status Check When No Snapshots Are Uploaded

Your team may require a Snapshot Testing check on every pull request, even when some CI workflows don't produce snapshots. For example, a pull request that changes only documentation or other files that don't affect the rendered UI may not need new snapshots. In these cases, use the [skip endpoint](/api/snapshots/create-a-skipped-snapshot-status-check/) to create a neutral check for the pull request's head commit so that it can merge without generating unnecessary snapshots.

<Alert level="warning">
The upload and skip paths should be mutually exclusive. Each workflow should
either upload snapshots or mark the check as skipped.
</Alert>

The example below assumes an earlier path-filtering step with an ID of `changes` sets a `should_upload` output. Use the same condition for your upload step and the inverse condition for the skip step so that only one runs. Reuse the `SENTRY_AUTH_TOKEN` configured for uploads and store it as an [encrypted GitHub Actions secret](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions).

```yml {filename:skip_status_checks_example.yml}
- name: Mark Snapshot Testing as skipped
if: github.event_name == 'pull_request' && steps.changes.outputs.should_upload == 'false'
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
jq -n \
--arg sha "$HEAD_SHA" \
--arg repository "$GITHUB_REPOSITORY" \
'{sha: $sha, repository: $repository, provider: "github"}' |
curl --fail-with-body \
--request POST \
--header "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
--header "Content-Type: application/json" \
--data-binary @- \
"https://sentry.io/api/0/projects/$SENTRY_ORG/$SENTRY_PROJECT/preprod/snapshots/status-checks/skip/"
```

This example is configured for GitHub.com. For GitHub Enterprise, set `provider` to `github_enterprise`.

## Troubleshooting

### Status Check Not Appearing
Expand Down
Loading