Support setting arbitrary secrets for tests step #33
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #32
Sometimes tests require secret tokens to run (e.g. https://github.com/pkgjs/wiby needs
GITHUB_TOKEN
to properly test integration with Github). Reusable workflows do not make this easy - unlike regular steps, you're not allowed to setjobs.<job_id>.env
for reusable workflows; the env vars set on the calling workflow are not passed through; the secrets need to be explicitly enumerated in the called (shared) workflow.Hence the hack - pass the secrets as a JSON object 🤷♂️.
Usage:
The param is called
test-secrets
, because it only sets the values for the test step. We have scope to explicitly addinstall-secrets
,checkout-secrets
, etc in the future.I'll be writing up the documentation next, and I'll make sure to add the usual caveats of leaking secrets via environment.
Test runs:
TESTING_TESTING
secret, but it is not available in the repo secrets: https://github.com/dominykas/pkgjs-action/actions/runs/1646277491/attempts/1 (there's a warning in the logs)TESTING_TESTING
is set up correctly: https://github.com/dominykas/pkgjs-action/actions/runs/1646277491/attempts/2secrets
configured for the workflow: https://github.com/dominykas/pkgjs-action/actions/runs/1646292401