From 0fa7ecdda40155052196e2a030fb96f52e8518d2 Mon Sep 17 00:00:00 2001 From: Evgeny Slutsky Date: Wed, 21 Jun 2023 16:16:19 +0300 Subject: [PATCH] post review code cleanup Signed-off-by: Evgeny Slutsky --- .github/workflows/create-new-pr.yml | 16 ++++--------- .github/workflows/run-osp-extended-tests.yml | 24 ++++++++------------ 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/.github/workflows/create-new-pr.yml b/.github/workflows/create-new-pr.yml index 3eb8dcf11..22656abec 100644 --- a/.github/workflows/create-new-pr.yml +++ b/.github/workflows/create-new-pr.yml @@ -5,6 +5,10 @@ on: jobs: new_pr_greeter: + if: github.event.issue.pull_request && + startsWith(github.event.comment.body, '/test-osp-extended') && ( + github.event.comment.author_association == 'MEMBER' || + github.event.comment.author_association == 'COLLABORATOR') runs-on: ubuntu-latest permissions: pull-requests: write @@ -12,20 +16,8 @@ jobs: - name: Checkout forklift uses: actions/checkout@v3 - - id: codeowner - uses: SvanBoxel/codeowners-action@v1 - with: - path: './.github/CODEOWNERS' - - - name: fail if the commenter doesnt exists in codeowners - id: allowedaccess - run: | - echo allowed=$(echo '${{ steps.codeowner.outputs.codeowners }}' | \ - jq -r '."tests/" | index("@${{ github.actor }}")') >> $GITHUB_OUTPUT - - name: Add comment to PR uses: actions/github-script@v6 - if: ${{ steps.allowedaccess.outputs.allowed == '1' }} with: script: | diff --git a/.github/workflows/run-osp-extended-tests.yml b/.github/workflows/run-osp-extended-tests.yml index 9a847ec91..668184a6b 100644 --- a/.github/workflows/run-osp-extended-tests.yml +++ b/.github/workflows/run-osp-extended-tests.yml @@ -2,20 +2,25 @@ name: openstack-extended-tests on: workflow_dispatch: name: - description: 'run e2e openstack extended tests on Self hosted runner' + description: 'run e2e openstack extended tests on a self hosted runner' workflow_call: issue_comment: types: [ created ] # ensures that only a single workflow will run at the same time -# if another workflow triggered it will pending until first completion. +# if another workflow triggered it will be pending until first completion. concurrency: group: hosted-e2e # A workflow run is made up of one or more jobs that can run sequentially jobs: create_ovirt_runner: - if: github.event.issue.pull_request && contains(github.event.comment.body, '/test-osp-extended') + if: github.event_name == 'workflow_dispatch' || + ( github.event_name == 'issue_comment' && + startsWith(github.event.comment.body, '/test-osp-extended') && ( + github.event.comment.author_association == 'MEMBER' || + github.event.comment.author_association == 'COLLABORATOR') + ) runs-on: ubuntu-latest steps: - name: Get PR branch @@ -32,16 +37,6 @@ jobs: - name: Checkout forklift uses: actions/checkout@v3 - - id: codeowner - uses: SvanBoxel/codeowners-action@v1 - with: - path: './.github/CODEOWNERS' - - - name: fail if the commenter doesnt exists in codeowners - run: | - [[ $(echo '${{ steps.codeowner.outputs.codeowners }}' | \ - jq -r '."tests/" | index("@${{ github.event.comment.user.login }}")') -eq 1 ]] - - name: prepare the secrets uses: kubev2v/forkliftci/ci/prepare-ansible-secrets@v5.0 with: @@ -62,7 +57,6 @@ jobs: ci_setup: if: github.event.issue.pull_request && contains(github.event.comment.body, '/test-osp-extended') runs-on: self-hosted - #runs-on: ubuntu-latest needs: create_ovirt_runner env: USE_BAZEL_VERSION: 5.4.0 @@ -123,7 +117,7 @@ jobs: if: always() with: script: | - const name = '${{ github.workflow }}'; + const name = '${{ github.workflow }}'; const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'; const success = '${{ job.status }}' === 'success'; const body = `${name}: ${success ? 'succeeded ✅' : 'failed ❌'}\n${url}`;