From f8652dd355a85d9e0ee2c9dfd5269e09e7806946 Mon Sep 17 00:00:00 2001 From: splincode Date: Fri, 6 Oct 2023 11:17:43 +0300 Subject: [PATCH] ci: add auto approve validation --- .github/workflows/auto-approve.yml | 54 ++++++++++++++++++++++++++---- .github/workflows/e2e.yml | 9 +++++ .github/workflows/npm-publish.yml | 1 + 3 files changed, 57 insertions(+), 7 deletions(-) diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml index 4f73290a4..d2115f058 100644 --- a/.github/workflows/auto-approve.yml +++ b/.github/workflows/auto-approve.yml @@ -1,16 +1,56 @@ -name: 🤖 Auto approve by bot +name: 🤖 Auto approve validation on: pull_request +env: + PR_JOBS_NAME: + '[ "Packages", "Demo", "Firebase", "typecheck", "cspell", "prettier", "stylelint", "eslint", "tests", "E2E result" ]' + RELEASE_JOBS_NAME: '[ "Publish" ]' + jobs: - automated-pull-request: + setup: runs-on: ubuntu-latest - permissions: - pull-requests: write + outputs: + matrix: ${{ steps.matrix.outputs.value }} steps: - - uses: actions/checkout@v4.1.0 - - uses: taiga-family/ci/actions/setup/variables@v1.25.7 - - uses: taiga-family/ci/actions/auto/approve/double@v1.25.7 + - uses: taiga-family/ci/actions/setup/checkout@v1.25.8 + - uses: taiga-family/ci/actions/setup/variables@v1.25.8 + - id: matrix if: env.TAIGA_FAMILY_BOT_IS_AUTHOR == 'true' + run: | + if [[ "${{ env.IS_RELEASE_BRANCH }}" == "false" ]]; then + echo "value=$PR_JOBS_NAME" >> $GITHUB_OUTPUT + else + echo "value=$RELEASE_JOBS_NAME" >> $GITHUB_OUTPUT + fi + + wait: + needs: [setup] + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + value: ${{ fromJSON(needs.setup.outputs.matrix) }} + steps: + - uses: taiga-family/ci/actions/run/wait-job@v1.25.8 + with: + token: ${{ secrets.GITHUB_TOKEN }} + job: ${{ matrix.value }} + + approve: + needs: [wait] + runs-on: ubuntu-latest + steps: + - uses: taiga-family/ci/actions/setup/checkout@v1.25.8 + - uses: taiga-family/ci/actions/setup/variables@v1.25.8 + - uses: taiga-family/ci/actions/auto/approve/double@v1.25.8 with: token1: ${{ secrets.GITHUB_TOKEN }} token2: ${{ secrets.TAIGA_FAMILY_APPROVE_BOT_PAT }} + - uses: taiga-family/ci/actions/run/merge@v1.25.8 + if: env.IS_RELEASE_BRANCH == 'false' + with: + token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }} + +concurrency: + group: auto-approve-${{ github.head_ref }} + cancel-in-progress: true diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 7386395c4..0c97acfcd 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -110,6 +110,15 @@ jobs: run: npm run cy:run -- --spec "**/(angular|react|ssr|addons|others)/**/*.cy.ts" --config baseUrl="${{ env.UNIVERSAL_SERVER }}" + + result: + if: ${{ !contains(github.head_ref, 'release/') }} + needs: [build-demo, e2e-kit, e2e-recipes, e2e-others] + runs-on: ubuntu-latest + name: E2E result + steps: + - run: echo "Success" + concurrency: group: e2e-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 9072fca03..6467cd902 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -9,6 +9,7 @@ env: jobs: publish: + name: Publish runs-on: ubuntu-latest steps: - uses: actions/checkout@v4.1.0