Skip to content

CI fails on PRs from external forks #1029

@MantisClone

Description

@MantisClone

Problem

The payment-detection tests rely on the EXPLORER_API_KEY_* secrets. Secrets are not available to PRs from external forks.

Example

https://app.circleci.com/pipelines/github/RequestNetwork/requestNetwork/7596/workflows/7c85970e-2bc8-4c54-b8dc-1e1551cea23e/jobs/124290

Solution

Skip tests that rely on secrets in PRs from external forks.

Details

The particular variable of interest to us is CIRCLE_PR_NUMBER, documented as “the number of the associated GitHub or Bitbucket pull request. Only available on forked PRs.” If CIRCLE_PR_NUMBER exists, then we know we are running a build for a forked PR that does not have access to secrets.

To express this condition in shell syntax, we use the -n (non-zero length) test. The condition will look like this:

if [ -n "$CIRCLE_PR_NUMBER" ]; then
  # mark this job successful and stop processing
fi

Reference

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions