Skip to content

Commit

Permalink
Change ref to sha
Browse files Browse the repository at this point in the history
  • Loading branch information
olly committed Mar 19, 2021
1 parent 66a759d commit 5613505
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions action.yml
Expand Up @@ -8,8 +8,8 @@ inputs:
description: 'The environment to deploy to. Either "staging" or "production".'
namespace:
description: 'The namespace to deploy to. Only valid if `environment` is "staging".'
ref:
description: 'The commit reference to deploy.'
sha:
description: 'The commit SHA to deploy.'
github_access_token:
description: 'A GitHub Personal Access Token with `repo`'
required: true
Expand Down
20 changes: 10 additions & 10 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions src/main.ts
Expand Up @@ -30,14 +30,14 @@ async function createDeployment(
client: Octokit,
app: string,
environment: DeploymentEnvironment,
ref: string
sha: string
): Promise<Deployment> {
core.info(`Triggered Build: ${app} ${environment} @ ${ref}`)
core.info(`Triggered Build: ${app} ${environment} @ ${sha}`)

const response = await client.repos.createDeployment({
owner: ORGANISATION,
repo: app,
ref,
ref: sha,
task: 'deploy',
auto_merge: false,
environment: environment.toString(),
Expand Down Expand Up @@ -101,13 +101,13 @@ async function triggerDeploymentsFromPushEvent(
}

const app = event.repository.name
const ref = event.after
const sha = event.after

const productionDeployment = await createDeployment(
client,
app,
new DeploymentEnvironment(Environment.Production, ''),
ref
sha
)

const reserved = await reservedDeploymentEnvironments(client, app)
Expand All @@ -117,7 +117,7 @@ async function triggerDeploymentsFromPushEvent(

const stagingDeployments = needsMasterUpdate.map(
async (deploymentEnvironment): Promise<Deployment> => {
return createDeployment(client, app, deploymentEnvironment, ref)
return createDeployment(client, app, deploymentEnvironment, sha)
}
)

Expand Down Expand Up @@ -152,17 +152,17 @@ async function triggerDeployment(): Promise<Deployment[]> {
const app = core.getInput('APP')
const environment = core.getInput('ENVIRONMENT')
const namespace = core.getInput('NAMESPACE')
const ref = core.getInput('REF')
const sha = core.getInput('SHA')

const token = core.getInput('GITHUB_ACCESS_TOKEN')
const client = github.getOctokit(token)

core.info(`APP: ${app}`)
core.info(`ENVIRONMENT: ${environment}`)
core.info(`NAMESPACE: ${namespace}`)
core.info(`REF: ${ref}`)
core.info(`sha: ${sha}`)

if (app === '' && environment === '' && namespace === '' && ref === '') {
if (app === '' && environment === '' && namespace === '' && sha === '') {
// Guess deployment based on event
// - if push event: on master, create single production deployment; create staging deployment for each
// label which doesn't have an open PR assigned.
Expand Down Expand Up @@ -195,7 +195,7 @@ async function triggerDeployment(): Promise<Deployment[]> {
client,
app,
deploymentEnviroment,
ref
sha
)
return [deployment]
}
Expand Down

0 comments on commit 5613505

Please sign in to comment.