From 361c83406955237fc46ff37ea62af3c293e44910 Mon Sep 17 00:00:00 2001 From: Quintin Willison Date: Mon, 26 Sep 2022 10:31:35 +0100 Subject: [PATCH] Give the deploymentRef variable a prefix to make it clearer that it relates specifically to GitHub. --- src/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index 70e1992..c6f6cfd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -57,19 +57,19 @@ const s3BucketName = 'sdk.ably.com'; const sourcePath = path.resolve(core.getInput('sourcePath')); const artifactName = core.getInput('artifactName'); -let deploymentRef: string; +let githubDeploymentRef: string; let s3KeyPrefix = `builds/${context.repo.owner}/${context.repo.repo}/`; let githubEnvironmentName = 'staging/'; if (context.eventName === 'pull_request') { - deploymentRef = evt.pull_request.head.sha; + githubDeploymentRef = evt.pull_request.head.sha; s3KeyPrefix += `pull/${evt.pull_request.number}`; githubEnvironmentName += `pull/${evt.pull_request.number}`; } else if (context.eventName === 'push' && ref !== null && ref.type === 'head' && ref.name === 'main') { - deploymentRef = context.sha; + githubDeploymentRef = context.sha; s3KeyPrefix += 'main'; githubEnvironmentName += 'main'; } else if (context.eventName === 'push' && ref !== null && ref.type === 'tag') { - deploymentRef = context.sha; + githubDeploymentRef = context.sha; s3KeyPrefix += `tag/${ref.name}`; githubEnvironmentName += `tag/${ref.name}`; } else { @@ -98,7 +98,7 @@ const upload = async (params: PutObjectCommandInput) => { const createDeployment = async () => { const response = await octokit.repos.createDeployment({ ...context.repo, - ref: deploymentRef, + ref: githubDeploymentRef, task: artifactName, required_contexts: [], githubEnvironmentName,