From 9f2df2721151d60bfa1426b91085ecec6e94c7e4 Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Mon, 30 Sep 2024 17:50:39 +0300 Subject: [PATCH] ci: cleanup workflows (#9274) Co-authored-by: taiga-family-bot --- .github/workflows/assign-author.yml | 18 +++++ .github/workflows/auto-merge.yml | 55 +++++++++++++++ .github/workflows/auto-update-icons.yml | 4 ++ .github/workflows/build.yml | 2 +- .github/workflows/create-release.yml | 2 +- .github/workflows/deploy-gh-pages.yml | 2 +- .github/workflows/deploy-preview.yml | 2 +- .github/workflows/e2e-cypress.yml | 2 +- .github/workflows/e2e-playwright.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/pr.yml | 93 ------------------------- .github/workflows/publish-canary.yml | 2 +- .github/workflows/publish.yml | 2 +- .github/workflows/ready-to-merge.yml | 21 ++++++ .github/workflows/snapshots.yml | 2 +- .github/workflows/test.yml | 2 +- 16 files changed, 109 insertions(+), 104 deletions(-) create mode 100644 .github/workflows/assign-author.yml create mode 100644 .github/workflows/auto-merge.yml delete mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/ready-to-merge.yml diff --git a/.github/workflows/assign-author.yml b/.github/workflows/assign-author.yml new file mode 100644 index 000000000000..59c2e5d1ca76 --- /dev/null +++ b/.github/workflows/assign-author.yml @@ -0,0 +1,18 @@ +name: 🤖 PR author as an assignee +on: + pull_request: + +jobs: + assign: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.2.0 + - uses: taiga-family/ci/actions/setup/variables@v1.87.0 + - uses: toshimaru/auto-author-assign@v2.1.1 + if: env.IS_OWNER_MODE == 'true' + with: + repo-token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml new file mode 100644 index 000000000000..e9b1737105be --- /dev/null +++ b/.github/workflows/auto-merge.yml @@ -0,0 +1,55 @@ +name: 🤖 PR auto merge +on: + pull_request: + +env: + PR_JOBS_NAME: '[ "Build packages", "Firebase", "Lint", "Unit tests", "Component testing result", "E2E result" ]' + RELEASE_JOBS_NAME: '[ "Publish" ]' + +jobs: + setup: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.matrix.outputs.value }} + steps: + - uses: actions/checkout@v4.2.0 + - uses: taiga-family/ci/actions/setup/variables@v1.87.0 + - id: matrix + if: env.IS_TAIGA_FAMILY_BOT_PR_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.87.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + job: ${{ matrix.value }} + + approve: + needs: [wait] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.2.0 + - uses: taiga-family/ci/actions/setup/variables@v1.87.0 + - uses: taiga-family/ci/actions/auto/approve/double@v1.87.0 + with: + token1: ${{ secrets.GITHUB_TOKEN }} + token2: ${{ secrets.TAIGA_FAMILY_APPROVE_BOT_PAT }} + - uses: taiga-family/ci/actions/run/merge@v1.87.0 + with: + token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true diff --git a/.github/workflows/auto-update-icons.yml b/.github/workflows/auto-update-icons.yml index fd0112fbbeab..139f40a1dfd3 100644 --- a/.github/workflows/auto-update-icons.yml +++ b/.github/workflows/auto-update-icons.yml @@ -36,3 +36,7 @@ jobs: with: message: icons have changed token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c85e7abcdff1..3855a05bbd6d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,5 +31,5 @@ jobs: CI_COMMIT_SHA: ${{ env.CI_COMMIT_SHA }} concurrency: - group: build-${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index cdaf2d07856c..8dbed309451d 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -83,5 +83,5 @@ jobs: run: git push origin tag v${{ steps.run-release.outputs.new_version }} || echo "" concurrency: - group: create-release-${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml index 869a6eb2fb2e..7c0af1c25254 100644 --- a/.github/workflows/deploy-gh-pages.yml +++ b/.github/workflows/deploy-gh-pages.yml @@ -65,5 +65,5 @@ jobs: cname: taiga-ui.dev concurrency: - group: deploy-gh-pages + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml index 2e933bb7ee43..9961a1d899a1 100644 --- a/.github/workflows/deploy-preview.yml +++ b/.github/workflows/deploy-preview.yml @@ -23,5 +23,5 @@ jobs: expires: 1d concurrency: - group: firebase-${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/e2e-cypress.yml b/.github/workflows/e2e-cypress.yml index 7625d21ede5b..5e72ac87388b 100644 --- a/.github/workflows/e2e-cypress.yml +++ b/.github/workflows/e2e-cypress.yml @@ -18,5 +18,5 @@ jobs: - run: npx nx component-test demo-cypress concurrency: - group: e2e-cypress-${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/e2e-playwright.yml b/.github/workflows/e2e-playwright.yml index 266b4927f3fb..3e276c7b6294 100644 --- a/.github/workflows/e2e-playwright.yml +++ b/.github/workflows/e2e-playwright.yml @@ -139,5 +139,5 @@ jobs: exit 1 concurrency: - group: e2e-playwright-${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8795186437f7..d6b061d6225a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -32,5 +32,5 @@ jobs: token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }} concurrency: - group: lint-${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index 1b1fd04b9172..000000000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: 🤖 PR suites -on: - pull_request: - pull_request_review: - types: [submitted] - -env: - PR_JOBS_NAME: '[ "Build packages", "Firebase", "Lint", "Unit tests", "Component testing result", "E2E result" ]' - RELEASE_JOBS_NAME: '[ "Publish" ]' - -jobs: - setup: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.matrix.outputs.value }} - steps: - - uses: actions/checkout@v4.2.0 - - uses: taiga-family/ci/actions/setup/variables@v1.87.6 - - id: matrix - if: env.IS_TAIGA_FAMILY_BOT_PR_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.87.6 - with: - token: ${{ secrets.GITHUB_TOKEN }} - job: ${{ matrix.value }} - - approve: - needs: [wait] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.2.0 - - uses: taiga-family/ci/actions/setup/variables@v1.87.6 - - uses: taiga-family/ci/actions/auto/approve/double@v1.87.6 - with: - token1: ${{ secrets.GITHUB_TOKEN }} - token2: ${{ secrets.TAIGA_FAMILY_APPROVE_BOT_PAT }} - - uses: taiga-family/ci/actions/run/merge@v1.87.6 - if: env.IS_RELEASE_BRANCH == 'false' - with: - token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }} - - label-when-approved: - name: Label when approved - if: github.event.review.state == 'APPROVED' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.2.0 - - uses: taiga-family/ci/actions/setup/variables@v1.87.6 - - uses: taiga-family/ci/actions/auto/label-when-approved@v1.87.6 - with: - approvals: 2 - token: ${{ secrets.GITHUB_TOKEN }} - - assign-author: - name: PR author as an assignee - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.2.0 - - uses: taiga-family/ci/actions/setup/variables@v1.87.6 - - uses: toshimaru/auto-author-assign@v2.1.1 - if: env.IS_OWNER_MODE == 'true' - with: - repo-token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }} - - label-version: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.2.0 - - uses: taiga-family/ci/actions/setup/variables@v1.87.6 - - uses: taiga-family/ci/actions/run/node-info@v1.87.6 - id: nodejs-workspace - - uses: actions-ecosystem/action-add-labels@v1 - continue-on-error: true - with: - labels: v${{ steps.nodejs-workspace.outputs.root-package-major-version }} - -concurrency: - group: pr-suites-${{ github.head_ref }} - cancel-in-progress: true diff --git a/.github/workflows/publish-canary.yml b/.github/workflows/publish-canary.yml index 469eb14369ff..9aa0b919eba5 100644 --- a/.github/workflows/publish-canary.yml +++ b/.github/workflows/publish-canary.yml @@ -19,5 +19,5 @@ jobs: - run: npx ts-node ./scripts/publish-canary.ts concurrency: - group: publish-canary-${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e48f79384ce7..909d74a6cac1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -45,5 +45,5 @@ jobs: textLink: '@taiga-ui/cdk' concurrency: - group: release-${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/ready-to-merge.yml b/.github/workflows/ready-to-merge.yml new file mode 100644 index 000000000000..fe2421e352b8 --- /dev/null +++ b/.github/workflows/ready-to-merge.yml @@ -0,0 +1,21 @@ +name: 🤖 PR is ready to merge +on: + pull_request_review: + types: [submitted] + +jobs: + label-when-approved: + name: Label when approved + runs-on: ubuntu-latest + if: github.event.review.state == 'approved' + steps: + - uses: actions/checkout@v4.2.0 + - uses: taiga-family/ci/actions/setup/variables@v1.87.0 + - uses: taiga-family/ci/actions/auto/label-when-approved@v1.87.0 + with: + approvals: 1 + token: ${{ secrets.GITHUB_TOKEN }} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true diff --git a/.github/workflows/snapshots.yml b/.github/workflows/snapshots.yml index 74415857a9b0..e73d824c968a 100644 --- a/.github/workflows/snapshots.yml +++ b/.github/workflows/snapshots.yml @@ -50,5 +50,5 @@ jobs: GITHUB_TOKEN: ${{ secrets.TAIGA_FAMILY_BOT_PAT }} concurrency: - group: snapshots-${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 929bfe7be30c..759ee9149cd0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,5 +27,5 @@ jobs: name: units concurrency: - group: test-${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true