Skip to content

Commit

Permalink
Rename the evt variable to make it clearer that it relates specifical…
Browse files Browse the repository at this point in the history
…ly to GitHub, as well as to replace abbreviation.
  • Loading branch information
QuintinWillison committed Sep 26, 2022
1 parent 361c834 commit 46cf87d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (typeof githubRef !== 'string') {
const githubToken = core.getInput('githubToken');
const octokit = getOctokit(githubToken);

const evt = JSON.parse(fs.readFileSync(githubEventPath, 'utf8'));
const githubEvent = JSON.parse(fs.readFileSync(githubEventPath, 'utf8'));

const createRef = (githubRef: string) => {
// githubRef is in the form 'refs/heads/branch_name' or 'refs/tags/tag_name'
Expand Down Expand Up @@ -61,9 +61,9 @@ let githubDeploymentRef: string;
let s3KeyPrefix = `builds/${context.repo.owner}/${context.repo.repo}/`;
let githubEnvironmentName = 'staging/';
if (context.eventName === 'pull_request') {
githubDeploymentRef = evt.pull_request.head.sha;
s3KeyPrefix += `pull/${evt.pull_request.number}`;
githubEnvironmentName += `pull/${evt.pull_request.number}`;
githubDeploymentRef = githubEvent.pull_request.head.sha;
s3KeyPrefix += `pull/${githubEvent.pull_request.number}`;
githubEnvironmentName += `pull/${githubEvent.pull_request.number}`;
} else if (context.eventName === 'push' && ref !== null && ref.type === 'head' && ref.name === 'main') {
githubDeploymentRef = context.sha;
s3KeyPrefix += 'main';
Expand Down

0 comments on commit 46cf87d

Please sign in to comment.