Skip to content

Commit

Permalink
Give the deploymentRef variable a prefix to make it clearer that it r…
Browse files Browse the repository at this point in the history
…elates specifically to GitHub.
  • Loading branch information
QuintinWillison committed Sep 26, 2022
1 parent 958375a commit 361c834
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 361c834

Please sign in to comment.