Fix job for cleaning envs (#3958)
This commit is contained in:
parent
ce1854b2ca
commit
153ea5b77b
1 changed files with 5 additions and 3 deletions
8
.github/workflows/cleanEnvironments.js
vendored
8
.github/workflows/cleanEnvironments.js
vendored
|
@ -3,6 +3,8 @@ const fetch = require("node-fetch");
|
|||
|
||||
const program = new Command();
|
||||
|
||||
const pathToCloudAPI = "https://staging-cloud.saleor.io/platform/api/";
|
||||
|
||||
program
|
||||
.name("cleanEnvironments")
|
||||
.description("Clean environments")
|
||||
|
@ -31,7 +33,7 @@ async function getEnvironmentsForReleaseTesting(token) {
|
|||
|
||||
async function getEnvironments(token) {
|
||||
const response = await fetch(
|
||||
`https://staging-cloud.saleor.io/api/organizations/saleor/environments/`,
|
||||
`${pathToCloudAPI}organizations/saleor/environments/`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
|
@ -46,7 +48,7 @@ async function getEnvironments(token) {
|
|||
|
||||
async function cleanEnvironment(environment, snapshot, token) {
|
||||
const response = await fetch(
|
||||
`https://staging-cloud.saleor.io/api/organizations/saleor/environments/${environment.key}/restore/`,
|
||||
`${pathToCloudAPI}organizations/saleor/environments/${environment.key}/restore/`,
|
||||
{
|
||||
method: "PUT",
|
||||
body: JSON.stringify({ restore_from: snapshot }),
|
||||
|
@ -82,7 +84,7 @@ async function waitUntilTaskInProgress(taskId, environment) {
|
|||
|
||||
while (true) {
|
||||
const response = await fetch(
|
||||
`https://staging-cloud.saleor.io/api/service/task-status/${taskId}/`,
|
||||
`${pathToCloudAPI}service/task-status/${taskId}/`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
|
|
Loading…
Reference in a new issue