Construct the client with userAgent: 'b2-github-action/<version>'. The
SDK preserves its own b2-sdk-ts/ and @backblaze/b2-sdk tokens before
ours so Backblaze server-side logs see both attribution layers.
await client.authorize(). This is one-shot for the lifetime of the
action invocation. B2 auth tokens carry a 24h TTL; typical GitHub
Actions runs finish well inside that window. If a long-running job
outlives the token, the SDK transparently re-authorizes on the next
401, so the action layer does not need its own refresh loop.
Mask the resulting authorization token via core.setSecret so any later
log line that happens to include it (errors, debug traces) is redacted.
The transport parameter is only used by tests (the SDK's B2Simulator
provides one). Production callers leave it undefined to use the SDK's
default FetchTransport with its built-in SSRF guard.
Build an authorized B2Client.
Steps:
userAgent: 'b2-github-action/<version>'. The SDK preserves its ownb2-sdk-ts/and@backblaze/b2-sdktokens before ours so Backblaze server-side logs see both attribution layers.await client.authorize(). This is one-shot for the lifetime of the action invocation. B2 auth tokens carry a 24h TTL; typical GitHub Actions runs finish well inside that window. If a long-running job outlives the token, the SDK transparently re-authorizes on the next 401, so the action layer does not need its own refresh loop.core.setSecretso any later log line that happens to include it (errors, debug traces) is redacted.The
transportparameter is only used by tests (the SDK's B2Simulator provides one). Production callers leave it undefined to use the SDK's default FetchTransport with its built-in SSRF guard.