From c2555ed2c4b710d4b34b284ce08e07ac05e8fb6c 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 | 51 ++++++++++++++++++++++++++---- .github/workflows/e2e.yml | 9 ++++++ .github/workflows/lint.yml | 7 ++++ .github/workflows/npm-publish.yml | 1 + 4 files changed, 62 insertions(+), 6 deletions(-) diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml index 79015328e..69d5a820d 100644 --- a/.github/workflows/auto-approve.yml +++ b/.github/workflows/auto-approve.yml @@ -1,16 +1,55 @@ -name: 🤖 Auto approve by bot +name: 🤖 Auto approve validation on: pull_request +env: + PR_JOBS_NAME: '[ "Packages", "Demo", "Firebase", "Lint result", "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/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 + - 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 7215ce56f..f112dd26a 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/lint.yml b/.github/workflows/lint.yml index dfa20aa9c..fe0662e0a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -62,6 +62,13 @@ jobs: - uses: taiga-family/ci/actions/auto/push@v1.25.8 if: env.SUPPORT_AUTO_PUSH == 'true' + result: + needs: [typecheck, cspell, prettier, stylelint, eslint] + runs-on: ubuntu-latest + name: Lint result + steps: + - run: echo "Success" + concurrency: group: lint-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 3d1b6fb7b..db29b36aa 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