To push secrets from Infisical into GitHub Secrets instead, use GitHub Secret Syncs. Secret Syncs write secrets to GitHub, while this guide fetches them from Infisical at runtime.
Prerequisites
- An Infisical account on Infisical Cloud or a self-hosted instance
- A project with secrets configured
- Permission to create machine identities in your Infisical organization
- A GitHub repository with Actions enabled
Setup
Choose how your workflow should authenticate with Infisical:- OIDC (Recommended)
- Universal Auth
With OIDC Auth, no Infisical credentials are stored in GitHub. The workflow proves its identity with a token that GitHub issues at runtime.
Infisical creates the identity with Universal Auth configured and opens its details page.The context in the Subject field determines how narrowly the identity is scoped. These examples use the legacy subject prefix; for an immutable subject, append the same context to Replace
How OIDC authentication works
How OIDC authentication works
GitHub can vouch for a workflow’s identity, which means the workflow doesn’t need a stored credential to prove who it is.When a job starts, GitHub issues a short-lived OIDC token describing the repository, workflow, and context it came from. The action presents that token to Infisical, Infisical verifies its signature and checks its claims against your machine identity, and then returns a short-lived access token the action uses to fetch secrets.Because the trust relationship is defined by repository and context rather than by a shared credential, only the workflows you name can authenticate. Use OIDC unless your setup rules it out.
Step 1: Create a machine identity
Create a machine identity for your workflow:1
In your organization, select Access Control > Machine Identities.
2
Select + Create.
3
Enter a Name (e.g.,
orders-service-ci), select a Role, and select Create.Step 2: Add OIDC authentication
1
In the identity’s Authentication section, select + Add Auth Method.
2
Select OIDC Auth.
3
On the Configuration tab, fill in the fields below, then select Add.
GitHub.com repositories created after July 15, 2026 use immutable subject claims. For these repositories, use
repo:<owner>@<owner-id>/<repo>@<repo-id>:<context>. Configure the exact subject present in your workflow’s token.If authentication returns a 403, see the troubleshooting section.repo:<owner>@<owner-id>/<repo>@<repo-id>:repo:octocat/orders-service:ref:refs/heads/mainallows only workflows running on themainbranchrepo:octocat/orders-service:environment:productionallows only workflows running in theproductionenvironmentrepo:octocat/orders-service:*allows any workflow in the repository
Step 3: Remove Universal Auth
An identity can hold several auth methods, and any of them can authenticate it. Remove Universal Auth to make sure this identity can only authenticate through GitHub:1
In the identity’s Authentication section, open the menu on the Universal Auth row.
2
Select Remove Auth Method.
3
Enter
confirm, then select Remove.Step 4: Add the identity to your project
1
On the identity’s page, find the Projects section and select + Add to Project.
2
Select the Project containing the secrets your workflow needs, select a Role that can read those secrets, and select Add.
Step 5: Copy the identity ID and project slug
Copy the values you’ll use to configure the action and store them somewhere:1
At the top of the identity’s page, select Options > Copy Machine Identity ID.
2
In the Projects section, select the project you added. In the project sidebar, select Settings > General, then select Copy Project Slug in the Project Overview section.
The machine identity ID isn’t a secret. It’s a public identifier, so you can commit it directly to your workflow file.
Step 6: Add the action to your workflow
Add the Infisical Secrets Action to a workflow file in.github/workflows/, before the steps that need secrets:<machine-identity-id> and <project-slug> with the values you copied, and set env-slug to the environment you want to read from (e.g., dev, staging, prod).Every step after the action can now read your secrets as environment variables, and no Infisical credentials are stored in GitHub.
If your workflow runs on a self-hosted runner in AWS, the action can also authenticate with AWS Auth by setting
method: "aws-iam" and identity-id. The runner needs AWS credentials it can use and network access to the AWS STS endpoints.Configure the action
Reference secrets in later steps
Fetched secrets are available as environment variables to every later step in the same job. Reference them with standard environment variable syntax:Fetch from a specific folder
By default the action fetches secrets from the root of the environment. Setsecret-path to read from a folder, and recursive to include its subfolders:
Write secrets to a file
If your application reads a.env file instead of environment variables, set export-type to file. The path is relative to the workspace, so check out the repository first:
EU Cloud and self-hosted instances
The action targets Infisical Cloud US by default. Setdomain to point it elsewhere:
If your instance sits behind a header-based firewall, pass the required headers with
extra-headers, one Header-Name: value pair per line.Action inputs
Troubleshooting
Authentication fails with an access denied error
Authentication fails with an access denied error
Work through these in order:
- Confirm the workflow sets
permissions: id-token: write. Without it, GitHub never issues a token. - Confirm the Subject on the machine identity matches the repository and context the workflow actually runs in. A workflow triggered on a pull request or a tag has a different subject than one on
main. - Confirm the Audiences value matches the audience in the token, which is the repository owner’s URL unless you set
oidc-audience. - Confirm the identity was added to the project, not just created in the organization.
- Confirm
methodand the matching credential inputs are set. Withoutmethod: "oidc", the action defaults to Universal Auth and fails on missing credentials.
OIDC authentication fails with a 403 for a new or renamed repository
OIDC authentication fails with a 403 for a new or renamed repository
GitHub.com repositories created after July 15, 2026 use immutable subject claims. The repository owner and name are suffixed with their permanent numeric IDs, so a subject configured with the previous format won’t match and Infisical returns a To:Renaming or transferring a repository after that date also switches it to the immutable format. Existing repositories can opt in through GitHub’s OIDC settings or REST API. GitHub Enterprise Server is unaffected. See GitHub’s immutable subject claims announcement for details.Run
403 error.For example, the subject changed from:gh api repos/<owner>/<repo>/actions/oidc/customization/sub and copy the sub_claim_prefix value into the machine identity’s Subject field. A glob pattern such as repo:octocat@*/orders-service@*:ref:refs/heads/main can serve as a temporary workaround during migration, but it can also match recycled owner and repository names with different IDs. Use the exact IDs whenever possible.The action succeeds but my secrets are missing
The action succeeds but my secrets are missing
The action only injects what the identity can read from the path you requested. Check that:
project-slugmatches the slug from Copy Project Slug, not the project nameenv-slugmatches the environment’s slug rather than its display name. Slugs are lowercase, typicallydev,staging, andprodsecret-pathpoints at the folder holding the secrets, withrecursive: trueif they live in subfolders- The identity’s project role grants read access to that environment and path
How do I see what claims GitHub is sending?
How do I see what claims GitHub is sending?
Run github/actions-oidc-debugger in the repository to print the token’s claims, then compare them against the subject, audience, and claims configured on your machine identity. This is the fastest way to resolve a subject mismatch.
Can one job pull secrets from several environments or folders?
Can one job pull secrets from several environments or folders?
Yes. Add the action once for each source. When two sources define the same key, the later step’s value wins, so order the steps accordingly. If you export to files, give each step a different
file-output-path.Next steps
OIDC Auth
Review the full set of OIDC configuration options for GitHub.
Machine Identities
Understand how identities authenticate and what they can access.
GitHub Secret Syncs
Push secrets from Infisical into GitHub Secrets instead.
Secrets Delivery
Compare delivery methods across CI/CD, Kubernetes, and applications.