From d13cf7d06dca6d3a73e810218aabc03fd4ccce80 Mon Sep 17 00:00:00 2001 From: Karolina Rakoczy Date: Fri, 2 Sep 2022 10:06:23 +0200 Subject: [PATCH] leave comment if test fails (#2272) --- .github/workflows/approveAndMergeReleasePR.js | 7 ++++++- .github/workflows/tests-nightly.yml | 10 ++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/approveAndMergeReleasePR.js b/.github/workflows/approveAndMergeReleasePR.js index c88659d85..cd335ab78 100644 --- a/.github/workflows/approveAndMergeReleasePR.js +++ b/.github/workflows/approveAndMergeReleasePR.js @@ -12,6 +12,7 @@ program .option("--tests_status ", `tests status`) .option("--version ", "version of a project") .option("--pull_request_number ", "Pull Request number") + .option("--auto_release ", "is auto release") .action(async options => { const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN, @@ -53,7 +54,11 @@ program process.exit(2); } - if (isPatchRelease(options.version) && options.tests_status === "success") { + if ( + options.auto_release && + isPatchRelease(options.version) && + options.tests_status === "success" + ) { try { await octokit.request( "PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge", diff --git a/.github/workflows/tests-nightly.yml b/.github/workflows/tests-nightly.yml index 16e9133a3..8de417bd6 100644 --- a/.github/workflows/tests-nightly.yml +++ b/.github/workflows/tests-nightly.yml @@ -144,7 +144,7 @@ jobs: tag: ${{ steps.get-env-uri.outputs.ENV_URI }},${{ github.event.inputs.tags }} run-tests-on-release: - if: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.environment != 'PROD' && github.event.client_payload.environment != 'ENTERPRISE'}} + if: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.environment != 'PROD' && github.event.client_payload.environment != 'ENTERPRISE' && github.event.client_payload.project != 'DEMO'}} runs-on: ubuntu-latest outputs: status: ${{ job.status }} @@ -199,7 +199,7 @@ jobs: tag: ${{github.event.client_payload.project}}, ${{github.event.client_payload.environment}}, Critical, https://v${{ steps.version.outputs.formatted_version }}.staging.saleor.cloud add-review-and-merge-patch: - if: ${{github.event.client_payload.autoRelease}} + if: ${{ always() && needs.run-tests-on-release.outputs.status != "skipped" && needs.run-tests-on-release.outputs.status != "cancelled" }} runs-on: ubuntu-latest needs: [run-tests-on-release] steps: @@ -217,11 +217,12 @@ jobs: cd .github/workflows npm ci - - name: Add review and merge if patch + - name: Add review and merge if patch DASHBOARD env: tests_status: ${{ needs.run-tests-on-release.outputs.status}} version: ${{github.event.client_payload.version}} pull_request_number: ${{ github.event.client_payload.pullRequestNumber}} + auto_release: ${{github.event.client_payload.autoRelease}} run: | export GITHUB_TOKEN=$( \ curl --request GET --url ${{ secrets.VAULT_URL}} --header "Authorization: JWT ${{ secrets.VAULT_JWT }}" | jq -r .token \ @@ -230,4 +231,5 @@ jobs: node .github/workflows/approveAndMergeReleasePR.js \ --tests_status $tests_status \ --version $version \ - --pull_request_number $pull_request_number + --pull_request_number $pull_request_number \ + --auto_release $auto_release