Skip to content

Commit

Permalink
Revision 6116b17
Browse files Browse the repository at this point in the history
  • Loading branch information
qawolf-team committed Mar 22, 2024
1 parent af4f048 commit bff724e
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
22 changes: 11 additions & 11 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34382,7 +34382,7 @@ async function findOrCreateEnvironment({ qawolfApiKey, branch, pr, qaWolfTeamId,
});
log.debug(`Environment response: ${JSON.stringify(response.data)}`);
if (!response.data.data.createEnvironment.id) {
throw new Error("Environment ID not found in response");
throw Error("Environment ID not found in response");
}
return response.data.data.createEnvironment.id;
}
Expand Down Expand Up @@ -34484,7 +34484,7 @@ async function findOrCreateTrigger(args) {
log.debug(`Trigger response: ${JSON.stringify(creationResponse.data)}`);
const triggerId = creationResponse.data?.data?.createTrigger?.id;
if (!triggerId) {
throw new Error("Trigger ID not found in response");
throw Error("Trigger ID not found in response");
}
log.info(`Trigger created with ID: ${triggerId}`);
return triggerId;
Expand Down Expand Up @@ -34574,7 +34574,7 @@ async function getEnvironmentIdForBranch(qawolfApiKey, branch, log) {
log.debug(`Trigger response: ${JSON.stringify(response.data)}`);
const triggers = response.data?.data?.triggers;
if (!triggers || triggers.length === 0) {
throw new Error(`No environment found for branch: ${branch}`);
throw Error(`No environment found for branch: ${branch}`);
}
return triggers[0].environment_id;
}
Expand Down Expand Up @@ -34613,7 +34613,7 @@ async function getEnvironmentVariablesFromEnvironment({ qawolfApiKey, environmen
},
});
if (!retrievalResponse.data.data.environment) {
throw new Error(`Environment not found with ID: ${environmentId}. Please check the environment ID is correct.`);
throw Error(`Environment not found with ID: ${environmentId}. Please check the environment ID is correct.`);
}
return JSON.parse(retrievalResponse.data.data.environment.variablesJSON);
}
Expand Down Expand Up @@ -34658,7 +34658,7 @@ async function getTagsFromGenericTriggerInEnvironment({ qawolfApiKey, environmen
},
});
if (!retrievalResponse.data.data.environment) {
throw new Error(`Environment not found with ID: ${environmentId}. Please check the environment ID is correct.`);
throw Error(`Environment not found with ID: ${environmentId}. Please check the environment ID is correct.`);
}
return retrievalResponse.data.data.environment.triggers[0]?.tags?.map((tag) => tag);
}
Expand Down Expand Up @@ -34697,7 +34697,7 @@ async function handleOperation(operation, options) {
break;
case "run-tests":
if (!deploymentUrl) {
throw new Error("missing deployment url");
throw Error("missing deployment url");
}
await (0, testDeployment_1.testDeployment)({
branch,
Expand All @@ -34710,7 +34710,7 @@ async function handleOperation(operation, options) {
});
break;
default:
throw new Error(`invalid operation: ${operation}`);
throw Error(`invalid operation: ${operation}`);
}
}
exports.handleOperation = handleOperation;
Expand Down Expand Up @@ -34744,7 +34744,7 @@ const parseEnvironmentVariablesToJSON = (environmentVariablesInput) => {
.filter((parts) => parts[0]) // Filter out any lines that don't contain keys
.reduce((envVars, [key, ...rest]) => {
if (!key)
throw new Error("No key found");
throw Error("No key found");
// Combine the remaining parts back into the value string
const value = rest.join("=").trim();
return {
Expand Down Expand Up @@ -39429,11 +39429,11 @@ async function runGitHubAction() {
const baseEnvironmentId = core.getInput("base-environment-id");
const repoFullName = process.env.GITHUB_REPOSITORY;
if (!repoFullName) {
throw new Error("missing GITHUB_REPOSITORY");
throw Error("missing GITHUB_REPOSITORY");
}
const [owner, repo] = repoFullName.split("/");
if (!owner || !repo) {
throw new Error("invalid repo full name");
throw Error("invalid repo full name");
}
const inputEnvironmentVariablesJSON = environmentVariables
? (0, parseEnvironmentVariables_1.parseEnvironmentVariablesToJSON)(environmentVariables)
Expand All @@ -39458,7 +39458,7 @@ async function runGitHubAction() {
core.debug(`Selected pull request from SHA: ${pr.title} ${pr.html_url} ${pr.head.ref}`);
}
if (!branch) {
throw new Error(`No branch found for SHA or PR ref: ${sha}`);
throw Error(`No branch found for SHA or PR ref: ${sha}`);
}
core.debug(`Selected branch from SHA: ${branch}`);
const commitUrl = `https://github.com/${owner}/${repo}/commit/${sha}`;
Expand Down
2 changes: 1 addition & 1 deletion src/findOrCreateEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export async function findOrCreateEnvironment({
log.debug(`Environment response: ${JSON.stringify(response.data)}`);

if (!response.data.data.createEnvironment.id) {
throw new Error("Environment ID not found in response");
throw Error("Environment ID not found in response");
}

return response.data.data.createEnvironment.id;
Expand Down
2 changes: 1 addition & 1 deletion src/findOrCreateTrigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export async function findOrCreateTrigger(args: FindOrCreateTriggerParams) {

const triggerId = creationResponse.data?.data?.createTrigger?.id;
if (!triggerId) {
throw new Error("Trigger ID not found in response");
throw Error("Trigger ID not found in response");
}

log.info(`Trigger created with ID: ${triggerId}`);
Expand Down
2 changes: 1 addition & 1 deletion src/getEnvironmentIdForBranch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export async function getEnvironmentIdForBranch(

const triggers = response.data?.data?.triggers;
if (!triggers || triggers.length === 0) {
throw new Error(`No environment found for branch: ${branch}`);
throw Error(`No environment found for branch: ${branch}`);
}

return triggers[0].environment_id;
Expand Down
2 changes: 1 addition & 1 deletion src/getEnvironmentVariablesFromEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function getEnvironmentVariablesFromEnvironment({
);

if (!retrievalResponse.data.data.environment) {
throw new Error(
throw Error(
`Environment not found with ID: ${environmentId}. Please check the environment ID is correct.`,
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/getTagsFromEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function getTagsFromGenericTriggerInEnvironment({
);

if (!retrievalResponse.data.data.environment) {
throw new Error(
throw Error(
`Environment not found with ID: ${environmentId}. Please check the environment ID is correct.`,
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/handleOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function handleOperation(
break;
case "run-tests":
if (!deploymentUrl) {
throw new Error("missing deployment url");
throw Error("missing deployment url");
}
await testDeployment({
branch,
Expand All @@ -71,6 +71,6 @@ export async function handleOperation(
});
break;
default:
throw new Error(`invalid operation: ${operation}`);
throw Error(`invalid operation: ${operation}`);
}
}
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ async function runGitHubAction() {
const repoFullName = process.env.GITHUB_REPOSITORY;

if (!repoFullName) {
throw new Error("missing GITHUB_REPOSITORY");
throw Error("missing GITHUB_REPOSITORY");
}

const [owner, repo] = repoFullName.split("/");

if (!owner || !repo) {
throw new Error("invalid repo full name");
throw Error("invalid repo full name");
}

const inputEnvironmentVariablesJSON = environmentVariables
Expand Down Expand Up @@ -62,7 +62,7 @@ async function runGitHubAction() {
}

if (!branch) {
throw new Error(`No branch found for SHA or PR ref: ${sha}`);
throw Error(`No branch found for SHA or PR ref: ${sha}`);
}

core.debug(`Selected branch from SHA: ${branch}`);
Expand Down
2 changes: 1 addition & 1 deletion src/parseEnvironmentVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const parseEnvironmentVariablesToJSON = (
.map((line) => line.split("=")) // Split each line into key-value pairs
.filter((parts) => parts[0]) // Filter out any lines that don't contain keys
.reduce((envVars, [key, ...rest]) => {
if (!key) throw new Error("No key found");
if (!key) throw Error("No key found");
// Combine the remaining parts back into the value string
const value = rest.join("=").trim();
return {
Expand Down

0 comments on commit bff724e

Please sign in to comment.