From 6a750671c394ca0c5ab29ed9100c65710e369ee6 Mon Sep 17 00:00:00 2001 From: Matan Shkalim Date: Mon, 20 Mar 2023 15:40:52 +0000 Subject: [PATCH 1/3] change trigger for wf Signed-off-by: Matan Shkalim --- ...de-review-approved.yaml => 01-pr-merged.yaml} | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) rename .github/workflows/{01-code-review-approved.yaml => 01-pr-merged.yaml} (63%) diff --git a/.github/workflows/01-code-review-approved.yaml b/.github/workflows/01-pr-merged.yaml similarity index 63% rename from .github/workflows/01-code-review-approved.yaml rename to .github/workflows/01-pr-merged.yaml index 712c89c0..469c55ab 100644 --- a/.github/workflows/01-code-review-approved.yaml +++ b/.github/workflows/01-pr-merged.yaml @@ -1,7 +1,8 @@ -name: 01-code_review_approved +name: 01-pr-merged + on: - pull_request_review: - types: [submitted] + pull_request_target: + types: [closed] branches: - 'master' - 'main' @@ -14,12 +15,14 @@ on: - 'docs/*' - 'build/*' - '.github/*' + concurrency: - group: code-review-approved + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true + jobs: binary-build: - if: ${{ github.event.review.state == 'approved' && contains( github.event.pull_request.labels.*.name, 'trigger-integration-test') && github.event.pull_request.base.ref == 'master' }} ## run only if labeled as "trigger-integration-test" and base branch is master + if: ${{ github.event.pull_request.merged == true && contains( github.event.pull_request.labels.*.name, 'trigger-integration-test') && github.event.pull_request.base.ref == 'master' }} ## run only if labeled as "trigger-integration-test" and base branch is master uses: ./.github/workflows/b-binary-build-and-e2e-tests.yaml with: COMPONENT_NAME: kubescape @@ -29,11 +32,12 @@ jobs: RELEASE: "" CLIENT: test secrets: inherit + merge-to-master: needs: binary-build env: GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - if: ${{ (github.event.review.state == 'approved' && github.event.pull_request.base.ref == 'master') && (always() && (contains(needs.*.result, 'success') || contains(needs.*.result, 'skipped')) && !(contains(needs.*.result, 'failure')) && !(contains(needs.*.result, 'cancelled'))) }} + if: ${{ (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master') && (always() && (contains(needs.*.result, 'success') || contains(needs.*.result, 'skipped')) && !(contains(needs.*.result, 'failure')) && !(contains(needs.*.result, 'cancelled'))) }} runs-on: ubuntu-latest steps: - name: merge-to-master From 085be861977f798df95d390f7623fb490a53feb3 Mon Sep 17 00:00:00 2001 From: Matan Shkalim Date: Tue, 21 Mar 2023 08:01:59 +0000 Subject: [PATCH 2/3] remove merge action Signed-off-by: Matan Shkalim --- .github/workflows/01-pr-merged.yaml | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/.github/workflows/01-pr-merged.yaml b/.github/workflows/01-pr-merged.yaml index 469c55ab..63e31591 100644 --- a/.github/workflows/01-pr-merged.yaml +++ b/.github/workflows/01-pr-merged.yaml @@ -31,22 +31,4 @@ jobs: GO_VERSION: "1.19" RELEASE: "" CLIENT: test - secrets: inherit - - merge-to-master: - needs: binary-build - env: - GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - if: ${{ (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master') && (always() && (contains(needs.*.result, 'success') || contains(needs.*.result, 'skipped')) && !(contains(needs.*.result, 'failure')) && !(contains(needs.*.result, 'cancelled'))) }} - runs-on: ubuntu-latest - steps: - - name: merge-to-master - if: ${{ env.GH_PERSONAL_ACCESS_TOKEN }} - uses: pascalgn/automerge-action@eb68b061739cb9d81564f8e812d0b3c45f0fb09a # ratchet:pascalgn/automerge-action@v0.15.5 - env: - GITHUB_TOKEN: "${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}" - MERGE_COMMIT_MESSAGE: "Merge to master - PR number: {pullRequest.number}" - MERGE_ERROR_FAIL: "true" - MERGE_METHOD: "merge" - MERGE_LABELS: "" - UPDATE_LABELS: "" + secrets: inherit \ No newline at end of file From bb576610fff089b775010a731e8e05071e38c46e Mon Sep 17 00:00:00 2001 From: Matan Shkalim Date: Tue, 21 Mar 2023 08:05:40 +0000 Subject: [PATCH 3/3] change concurrency in 00-pr-scanner Signed-off-by: Matan Shkalim --- .github/workflows/00-pr-scanner.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/00-pr-scanner.yaml b/.github/workflows/00-pr-scanner.yaml index 78287d42..0241f87b 100644 --- a/.github/workflows/00-pr-scanner.yaml +++ b/.github/workflows/00-pr-scanner.yaml @@ -15,9 +15,11 @@ on: - 'docs/*' - 'build/*' - '.github/*' + concurrency: - group: ${{ github.head_ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true + jobs: pr-scanner: permissions: