Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const axios = require('axios');
const WAIT_TIME = 1000;
const MAX_TRIES = 300;
const FIRST_WAIT = 2000;
const API_URL = "https://rapidapi.com/testing/api/trigger";


// INPUTS
const TEST_ID = core.getInput('test');
Expand All @@ -15,6 +15,9 @@ console.log(`Executing Test ID: ${TEST_ID}`);
const LOCATION = core.getInput('location');
console.log(`Executing In Location: ${LOCATION}`);

const INSTANCE = core.getInput('instance') || "rapidapi";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: define input in action.yml, possibly with a default "rapidapi.com"

console.log(`Executing In Instance: ${INSTANCE}`);

const ENVIRONMENT = core.getInput('environment') || null;
console.log(`Executing In Env: ${ENVIRONMENT}`);

Expand All @@ -30,7 +33,10 @@ function sleep(time) {
core.group('Execute Test', async () => {
// 1. Trigger Test
const envString = ENVIRONMENT ? `&enviroment=${ENVIRONMENT}` : '';
const instance = INSTANCE;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we make this the full domain w/ .com then we can just call this DOMAIN

const API_URL = `https://${INSTANCE}.com/testing/api/trigger`
const testTrigger = (await axios.get(`${API_URL}/test/${TEST_ID}/execute?source=gh_action&location=${LOCATION}${envString}`)).data;
console.log(testTrigger)
const reportUrl = testTrigger.reportUrl;
console.log(testTrigger.message);
core.setOutput("reportUrl", reportUrl);
Expand Down