Skip to content

Commit

Permalink
Fix GitHub token when Git context with subdir
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobwgillespie committed Aug 23, 2022
1 parent cbc0724 commit b0ce115
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/depot.ts
Expand Up @@ -25,6 +25,7 @@ export async function version() {

export async function build(inputs: Inputs) {
const defaultContext = context.getDefaultBuildContext()
const resolvedContext = handlebars.compile(inputs.context)({defaultContext})
const args = [
'build',
...flag('--add-host', inputs.addHosts),
Expand Down Expand Up @@ -64,13 +65,13 @@ export async function build(inputs: Inputs) {
),
...flag(
'--secret',
inputs.githubToken && !hasGitAuthTokenSecret(inputs.secrets) && inputs.context == defaultContext
inputs.githubToken && !hasGitAuthTokenSecret(inputs.secrets) && resolvedContext.startsWith(defaultContext)
? getSecret(`GIT_AUTH_TOKEN=${inputs.githubToken}`)
: false,
),

// Build context
handlebars.compile(inputs.context)({defaultContext}),
resolvedContext,
]

// Attempt to exchange GitHub Actions OIDC token for temporary Depot trust relationship token
Expand Down

0 comments on commit b0ce115

Please sign in to comment.