Fix rate limits in release tests (#3106)
* Fix rates limits in release tests * add authorization token to releases/latest request * fix token * add token
This commit is contained in:
parent
e69bf63498
commit
9151fb77aa
2 changed files with 18 additions and 10 deletions
16
.github/workflows/getEnvironmentVariables.js
vendored
16
.github/workflows/getEnvironmentVariables.js
vendored
|
@ -10,8 +10,12 @@ program
|
||||||
.description("Approve and merge PR if patch release")
|
.description("Approve and merge PR if patch release")
|
||||||
.option("--version <version>", "version of a project")
|
.option("--version <version>", "version of a project")
|
||||||
.option("--token <token>", "token fo login to cloud")
|
.option("--token <token>", "token fo login to cloud")
|
||||||
|
.option("--repo_token <repo_token>", "github token")
|
||||||
.action(async options => {
|
.action(async options => {
|
||||||
const isOldVersion = await checkIfOldVersion(options.version);
|
const isOldVersion = await checkIfOldVersion(
|
||||||
|
options.version,
|
||||||
|
options.repo_token,
|
||||||
|
);
|
||||||
core.setOutput("IS_OLD_VERSION", isOldVersion);
|
core.setOutput("IS_OLD_VERSION", isOldVersion);
|
||||||
|
|
||||||
if (!isPatchRelease(options.version)) {
|
if (!isPatchRelease(options.version)) {
|
||||||
|
@ -176,16 +180,18 @@ async function getDomainForUpdatedEnvironment(environmentId, token) {
|
||||||
return responseInJson.domain;
|
return responseInJson.domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkIfOldVersion(version) {
|
async function checkIfOldVersion(version, token) {
|
||||||
const newestVersion = await getTheNewestVersion();
|
const newestVersion = await getTheNewestVersion(token);
|
||||||
const howManyVersionsBehind =
|
const howManyVersionsBehind =
|
||||||
getFormattedVersion(newestVersion) - getFormattedVersion(version);
|
getFormattedVersion(newestVersion) - getFormattedVersion(version);
|
||||||
//All versions besides last three are old versions
|
//All versions besides last three are old versions
|
||||||
return howManyVersionsBehind > 2 ? "true" : "false";
|
return howManyVersionsBehind > 2 ? "true" : "false";
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getTheNewestVersion() {
|
async function getTheNewestVersion(token) {
|
||||||
const octokit = new Octokit();
|
const octokit = new Octokit({
|
||||||
|
auth: token,
|
||||||
|
});
|
||||||
|
|
||||||
const response = await octokit.request(
|
const response = await octokit.request(
|
||||||
"GET /repos/{owner}/{repo}/releases/latest",
|
"GET /repos/{owner}/{repo}/releases/latest",
|
||||||
|
|
4
.github/workflows/tests-nightly.yml
vendored
4
.github/workflows/tests-nightly.yml
vendored
|
@ -158,6 +158,7 @@ jobs:
|
||||||
url: ${{ steps.get-environment-variables.outputs.url }}
|
url: ${{ steps.get-environment-variables.outputs.url }}
|
||||||
is_old_version: ${{ steps.get-environment-variables.outputs.IS_OLD_VERSION }}
|
is_old_version: ${{ steps.get-environment-variables.outputs.IS_OLD_VERSION }}
|
||||||
env:
|
env:
|
||||||
|
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
TOKEN: ${{ secrets.CLOUD_ACCESS_TOKEN }}
|
TOKEN: ${{ secrets.CLOUD_ACCESS_TOKEN }}
|
||||||
VERSION: ${{github.event.client_payload.version}}
|
VERSION: ${{github.event.client_payload.version}}
|
||||||
steps:
|
steps:
|
||||||
|
@ -179,7 +180,8 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
node .github/workflows/getEnvironmentVariables.js \
|
node .github/workflows/getEnvironmentVariables.js \
|
||||||
--version $VERSION \
|
--version $VERSION \
|
||||||
--token "$TOKEN"
|
--token "$TOKEN" \
|
||||||
|
--repo_token "$REPO_TOKEN"
|
||||||
|
|
||||||
run-tests-on-release:
|
run-tests-on-release:
|
||||||
if: ${{ github.event_name == 'repository_dispatch' && (github.event.client_payload.environment == 'SANDBOX' || github.event.client_payload.environment == 'STAGING')}}
|
if: ${{ github.event_name == 'repository_dispatch' && (github.event.client_payload.environment == 'SANDBOX' || github.event.client_payload.environment == 'STAGING')}}
|
||||||
|
|
Loading…
Reference in a new issue