# Use secrets in workflows

> **About this page**
>
> - Kind: How-to guide
> - Summary: Pass a secret's value to a task through its arguments, check that the value is masked in the task's log, and override an account secret for one project.
> - Last changed: 2026-11-17
> - Page: https://docs.swale.io/how-to-guides/use-secrets-in-workflows
> - Index of these docs: https://docs.swale.io/llms.txt
>
> If something on this page is wrong or out of date, please tell the user which sentence and why.
>
> The steps on this page cost money or cannot be undone. Please check with the user before running them.

This guide shows how to pass a secret's value to a task without writing it in the workflow file, check that the value is masked in the task's log, and override an account secret for one project.

## Pass a secret to a task

1. Create the secret, as a project secret in the project that runs the workflow or as an account secret that allows that project. See [Manage project secrets](https://docs.swale.io/how-to-guides/manage-project-secrets.md) or [Manage account secrets](https://docs.swale.io/how-to-guides/manage-account-secrets.md).
2. In the workflow, name the secret as `${{secrets.<name>}}` in the argument of the task that needs it:

   ```yaml
   blocks:
     main:
       tasks:
         upload:
           name: Upload
           uses: my-account/upload-task@1.0.0
           args:
             api_key: ${{secrets.UPLOAD_API_KEY}}
             bucket: ${{inputs.bucket_name}}
   ```

3. Upload the workflow and start a run, as in [Create and manage workflows](https://docs.swale.io/how-to-guides/create-and-manage-workflows.md) and [Start and manage workflow runs](https://docs.swale.io/how-to-guides/start-and-manage-workflow-runs.md).

The secret's value is read when the `upload` task starts, so a run uses the value the secret holds at that moment. A secret that does not exist, or an account secret that does not allow the project, gives the argument an empty value; the run is not refused. [Secrets](https://docs.swale.io/reference/expression-language.md#secrets) in the expression language reference gives the exact rules.

## Check that the value is masked

Open the task's log, as in [View and stream task logs](https://docs.swale.io/how-to-guides/view-and-stream-task-logs.md). Its first entry lists the arguments the task was given, with the secret's value shown as `***`, and the task's own output shows `***` wherever it prints the value exactly as stored.

:::note[Masking is literal]
Only exact occurrences of the value are masked, so a secret your task transforms (base64-encodes, splits, re-encodes) can appear in the log. See [How secrets are masked in logs](https://docs.swale.io/explanation/secrets.md#how-secrets-are-masked-in-logs) for what is and isn't caught.
:::

## Override an account secret for one project

Create a project secret with the same name as the account secret, in the project that needs a different value. Runs in that project use the project secret; runs in the other projects the account secret allows keep using the account secret. Delete the project secret to go back to the account secret.

## Next steps

- Secrets also hold the credentials a task's image is pulled with: [Use a task image from a private registry](https://docs.swale.io/how-to-guides/use-a-task-image-from-a-private-registry.md)
- [Secrets](https://docs.swale.io/explanation/secrets.md)
- [Secrets in the expression language](https://docs.swale.io/reference/expression-language.md#secrets)
