Skip to content

Commit

Permalink
refactor: make constants uppercase
Browse files Browse the repository at this point in the history
  • Loading branch information
rickstaa committed Mar 1, 2023
1 parent 2a11659 commit d7d1253
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions scripts/preview-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ const INVALID_REVIEW_COMMENT = (commentUrl) =>

// Retrieve octokit instance.
const OCTOKIT = github.getOctokit(getGithubToken());
const pullRequestId = prNumber ? prNumber : getPrNumber();
const { owner, repo } = getRepoInfo(github.context);
const PULL_REQUEST_ID = prNumber ? prNumber : getPrNumber();
const { OWNER, REPO } = getRepoInfo(github.context);

/**
* Retrieve PR number from the event payload.
Expand Down Expand Up @@ -318,26 +318,26 @@ export const run = async (prNumber) => {
`;
const ccc = new ColorContrastChecker();
const commenter = getCommenter();
debug(`Owner: ${owner}`);
debug(`Repo: ${repo}`);
debug(`Owner: ${OWNER}`);
debug(`Repo: ${REPO}`);
debug(`Commenter: ${commenter}`);

// Retrieve the PR diff and preview-theme comment.
debug("Retrieve PR diff...");
const res = await OCTOKIT.pulls.get({
owner,
repo,
pull_number: pullRequestId,
OWNER,
REPO,
pull_number: PULL_REQUEST_ID,
mediaType: {
format: "diff",
},
});
debug("Retrieve preview-theme comment...");
const comment = await findComment(
OCTOKIT,
pullRequestId,
owner,
repo,
PULL_REQUEST_ID,
OWNER,
REPO,
commenter,
);

Expand Down Expand Up @@ -519,9 +519,9 @@ export const run = async (prNumber) => {
if (!DRY_RUN) {
comment_url = await upsertComment(OCTOKIT, {
comment_id: comment?.id,
issue_number: pullRequestId,
owner,
repo,
issue_number: PULL_REQUEST_ID,
OWNER,
REPO,
body: commentBody,
});
} else {
Expand All @@ -541,17 +541,17 @@ export const run = async (prNumber) => {
if (!DRY_RUN) {
await addReview(
OCTOKIT,
pullRequestId,
owner,
repo,
PULL_REQUEST_ID,
OWNER,
REPO,
reviewState,
reviewReason,
);
await addRemoveLabel(
OCTOKIT,
pullRequestId,
owner,
repo,
PULL_REQUEST_ID,
OWNER,
REPO,
"invalid",
!themesValid,
);
Expand All @@ -564,17 +564,17 @@ export const run = async (prNumber) => {
if (!DRY_RUN) {
await addReview(
OCTOKIT,
pullRequestId,
owner,
repo,
PULL_REQUEST_ID,
OWNER,
REPO,
"REQUEST_CHANGES",
error.message,
);
await addRemoveLabel(
OCTOKIT,
pullRequestId,
owner,
repo,
PULL_REQUEST_ID,
OWNER,
REPO,
"invalid",
true,
);
Expand Down

0 comments on commit d7d1253

Please sign in to comment.