Skip to content

Conversation

@burnash
Copy link
Collaborator

@burnash burnash commented Dec 5, 2025

When a PR comes from a fork, GitHub Actions doesn't expose repository secrets. This causes the docs examples tests to fail because many examples require external credentials (Postgres, BigQuery, Slack webhooks, etc.).

This PR adds an EXAMPLES_REQUIRING_SECRETS list to prepare_examples_tests.py that skips these examples when IS_FORK=true.

Fixes CI failures for external contributors
@burnash burnash requested review from rudolfix and sh-rp December 5, 2025 14:44
@burnash burnash self-assigned this Dec 5, 2025
@cloudflare-workers-and-pages
Copy link

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
docs 8b884fa Commit Preview URL

Branch Preview URL
Dec 05 2025, 02:51 PM

args = parser.parse_args()

# Check if CI is running on a fork pull request
is_fork = os.environ.get("IS_FORK") == "true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have a helper:

def is_running_in_github_fork() -> bool:



def is_running_in_github_fork() -> bool:
    """Check if executed by GitHub Actions, in a repo fork."""
    is_github_actions = is_running_in_github_ci()
    is_fork = os.environ.get("IS_FORK") == "true"  # custom var set by us in the workflow's YAML
    return is_github_actions and is_fork
    ```

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! However, the prepare_examples_tests.py script is in docs/docs_tools/examples/ and isn't a pytest test file, rather a standalone script that generates test files. Importing from tests/utils would create an awkward dependency from the docs tooling on the test utilities module. Additionally, the existing helper is_running_in_github_fork() does an extra check for GITHUB_ACTIONS == "true" via is_running_in_github_ci, but here we only need to check IS_FORK since this script only runs in CI anyway (and having IS_FORK=true already implies ci context)

If we want to keep things consistent, we could either:

  1. Keep it as-is (simple inline check, no dependency)
  2. Extract a shared utility for fork detection that both modules can use

I'd lean toward keeping it simple here, but happy to refactor if you prefer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah true... lets definitely not import that. option 2 is fine!

"chess_production",
"custom_destination_bigquery",
"custom_destination_lancedb",
"custom_naming",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

learning question: why this example?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

custom_naming example uses dlt.destinations.postgres() which requires Postgres credentials

dest_ = dlt.destinations.postgres(naming_convention="sql_cs_latin2")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense...so its just a bit inconsistent that this example doesnt include a example.secrets.toml

"custom_naming",
"google_sheets",
"incremental_loading",
"nested_data",
Copy link
Contributor

@djudjuu djudjuu Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question:partial_loading also uses aws creds so should be in there?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

partial_loading example, it uses local filesystem storage, not aws/s3 creds:

dest_ = dlt.destinations.filesystem("_storage")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah right, and in filesystem the bucket_url (assigned above) is used to determine the kind of credential needed (and local filesystem doesnt require any so nothing ever gets resolved)

Copy link
Contributor

@djudjuu djudjuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its an improvement. i guess we always pay special attention when merging outside stuff.
I assume tests also run on the merged devel branch so we should see failing examples there as well...or on the next pr that comes after and doesnt touch the code (not ideal, but better than now)

also: left two questions and a nitpick

@burnash
Copy link
Collaborator Author

burnash commented Dec 8, 2025

Thanks for the review @djudjuu, afaik the tests won't rerun on merge to devel.

@djudjuu
Copy link
Contributor

djudjuu commented Dec 8, 2025

Thanks for the review @djudjuu, afaik the tests won't rerun on merge to devel.
ah true...i clicked on the action and its just the deploy job

@burnash burnash merged commit d0fb75b into devel Dec 8, 2025
15 checks passed
@burnash burnash deleted the fix/forks-skip-docs-examples-requiring-secrets branch December 8, 2025 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants