undefined URI.
Example failure from the job log:
environment block, for example:
- Repository Secrets for sensitive values (passwords, API keys). These are available via
secrets. - Repository Variables for non-sensitive configuration (usernames, environment names). These are available via
vars.

MONGO_PASSWORD. The secret value is not visible after creation.
Next, add a repository variable for the Mongo username:

Use Actions Secrets for sensitive data (passwords, API keys) and Actions Variables for non-sensitive configuration (usernames, environment names). Secrets are masked in logs and are not visible after creation; variables can be edited and viewed in the repository settings by users with appropriate access.
- Use
:for YAML key/value pairs (not=). - Reference variables as
${{ vars.MONGO_USERNAME }}and secrets as${{ secrets.MONGO_PASSWORD }}. - Scope sensitive secrets at the job level if you want to limit exposure.
Key points and best practices
- Never hard-code credentials in workflows or repository files. Use repository secrets for passwords and API keys.
- Use repository variables for non-sensitive configuration so they are easy to change across workflows.
- Scope secrets to the job-level
envto reduce exposure to other jobs. - Use
actions/setup-node@v4to install a Node version compatible with your app (example uses Node 22). - If your tests produce JUnit XML (for example via
mocha-junit-reporter), upload the XML as an artifact in a follow-up step so the test results are accessible from the Actions UI.
Do not store credentials or secrets in plaintext in your repository. Secrets are masked in logs, but treating secrets responsibly (scoped, rotated, and audited) is critical for secure CI/CD.

actions/upload-artifact@v4) so test reports are visible from the GitHub Actions run UI.
Related references