Documentation
JSR Token Authentication
This document describes how BloqrAI uses JSR tokens for package publishing and consumption in GitHub Actions workflows.
Overview
JSR provides two types of tokens:
- Workflow Tokens (
JSR_WORKFLOW_TOKEN): Used for publishing packages from CI/CD pipelines. Scoped to specific namespaces/scopes (e.g.,@bloqr). - API Tokens (
JSR_API_TOKEN): Used for programmatic API access and package consumption (e.g., adding JSR packages as dependencies). General-purpose authentication.
Both tokens are stored as organization-level GitHub Action secrets in the BloqrAI organization and are scoped to the @bloqr JSR namespace.
Token Security & Rotation
- Tokens are stored as encrypted organization secrets in GitHub
- They are only accessible to workflows within the BloqrAI organization
- Tokens must be rotated regularly (recommend quarterly or when staff changes)
- Never hardcode tokens; always use
${{ secrets.JSR_WORKFLOW_TOKEN }}or${{ secrets.JSR_API_TOKEN }}
Publishing with Workflow Tokens
Configuration
The JSR_WORKFLOW_TOKEN is configured in:
- Location: BloqrAI GitHub organization secrets (Settings > Secrets and variables > Actions)
- Scope:
@bloqrnamespace (access to all packages under@bloqr/*) - Permissions: Publish packages
Usage in Workflows
Pass the token via the --token flag to deno publish:
- name: Publish to JSR
run: deno publish --token ${{ secrets.JSR_WORKFLOW_TOKEN }}
Important: Use the --token flag (not environment variable) — this is how deno publish accepts the token.
Example: .github/workflows/publish-jsr.yml
See .github/workflows/publish-jsr.yml for the full implementation. The workflow:
- Checks out the repository
- Sets up Deno v2.x
- Runs type checking, tests, and linting
- Performs a dry-run validation with
deno publish --dry-run - Publishes to JSR using the
JSR_WORKFLOW_TOKEN - Reports any failures with actionable error messages
Consuming Packages with API Tokens
Configuration
The JSR_API_TOKEN is configured in:
- Location: BloqrAI GitHub organization secrets (Settings > Secrets and variables > Actions)
- Scope:
@bloqrnamespace (read access to all packages under@bloqr/*) - Permissions: Read/consume packages
Usage in Workflows
Set the token as an environment variable before running Deno commands that fetch JSR packages:
- name: Add JSR package dependency
env:
JSR_TOKEN: ${{ secrets.JSR_API_TOKEN }}
run: deno add jsr:@bloqr/compiler-core
Usage in Local Development
To use JSR_API_TOKEN locally, store it in a .env file (never commit to git):
export JSR_TOKEN="jsr_pat_..."
deno cache jsr:@bloqr/compiler-core
Standard Pattern Across Repositories
All BloqrAI repositories that interact with JSR should follow this pattern:
- Publishing workflows: Use
JSR_WORKFLOW_TOKENin publish steps - Consuming workflows: Use
JSR_API_TOKENwhen adding/updating JSR dependencies - Documentation: Link back to this central documentation
- Token rotation: Rotate tokens quarterly or when staff changes
Troubleshooting
error: Permission denied: insufficient permissions to publish
- Check that
JSR_WORKFLOW_TOKENis configured as an organization secret - Verify the token's scope includes the
@bloqrnamespace - Confirm the package is linked to the GitHub repository in JSR settings
error: could not find JSR token
- Ensure the environment variable is named
JSR_TOKEN(notJSR_WORKFLOW_TOKEN) - Verify
${{ secrets.JSR_WORKFLOW_TOKEN }}is set correctly in the workflow
error: failed to resolve jsr:@bloqr/...
- When consuming packages, ensure
JSR_API_TOKENis configured for read access - Verify the package is published and accessible in JSR
- Check that
deno.lockis not stale (regenerate if needed)
Related Documentation
- JSR Publishing Documentation
- JSR API Authentication
- Deno Publishing Guide
- @bloqr/compiler-core JSR Package
Known Issues
OIDC Publishing Limitations (Archived)
Previous attempts to use OIDC-based trusted publishing from GitHub Actions failed with InvalidIssuer errors. While OIDC provides provenance attestations, token-based authentication is reliable and is the recommended approach for org-owned repositories.
See GitHub issue bloqr-core#XXX for details on OIDC investigation.
Token Rotation Checklist
When rotating tokens:
- Create new
JSR_WORKFLOW_TOKENon JSR - Create new
JSR_API_TOKENon JSR - Update both secrets in BloqrAI GitHub organization
- Test publishing workflow with new token
- Test dependency consumption with new token
- Delete old tokens from JSR
- Update this document with rotation date (optional)
Last Updated: 2026-08-09
Owned By: @BloqrAI/core-team