diff --git a/.github/workflows/pr-e2e-pr-validation.yml b/.github/workflows/pr-e2e-pr-validation.yml new file mode 100644 index 00000000000..c85ff4b5eba --- /dev/null +++ b/.github/workflows/pr-e2e-pr-validation.yml @@ -0,0 +1,19 @@ +name: e2e-on-pr-validation +on: + pull_request: + types: + - opened + - synchronize + - reopened + - labeled + - unlabeled + +jobs: + validate-e2e-labels: + name: Check e2e labels + runs-on: ubuntu-latest + steps: + - uses: docker://agilepathway/pull-request-label-checker:latest + with: + any_of: ok-to-merge + repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pr-e2e.yml b/.github/workflows/pr-e2e.yml index 1f608b9d280..48a6834ff32 100644 --- a/.github/workflows/pr-e2e.yml +++ b/.github/workflows/pr-e2e.yml @@ -2,26 +2,28 @@ name: pr-e2e-tests on: issue_comment: types: [created] + +env: + E2E_LABEL: ok-to-merge + jobs: triage: runs-on: ubuntu-latest name: Comment evaluate outputs: - run-e2e: ${{ startsWith(github.event.comment.body,'/run-e2e') && steps.check-permission.outputs.has-permission }} + run-e2e: ${{ startsWith(github.event.comment.body,'/run-e2e') && steps.checkUserMember.outputs.isTeamMember == 'true' }} pr_num: ${{ steps.parser.outputs.pr_num }} image_tag: "pr-${{ steps.parser.outputs.pr_num }}-${{ github.event.comment.id }}" steps: - - name: Check user permission - if: startsWith(github.event.comment.body,'/run-e2e') - id: check-permission - uses: scherermichael-oss/action-has-permission@master + - uses: tspascoal/get-user-teams-membership@v1 + id: checkUserMember with: - required-permission: write - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + username: ${{ github.actor }} + team: 'keda-e2e-test-executors' + GITHUB_TOKEN: ${{ secrets.GH_CHECKING_USER_AUTH }} - name: Update comment with the execution url - if: ${{ startsWith(github.event.comment.body,'/run-e2e') && steps.check-permission.outputs.has-permission }} + if: ${{ startsWith(github.event.comment.body,'/run-e2e') && steps.checkUserMember.outputs.isTeamMember == 'true' }} uses: peter-evans/create-or-update-comment@v2 with: comment-id: ${{ github.event.comment.id }} @@ -46,6 +48,13 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Remove label + id: remove + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr edit ${{ needs.triage.outputs.pr_num }} --remove-label '${{ env.E2E_LABEL}}' + - name: Checkout Pull Request env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -79,6 +88,13 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Remove label + id: remove + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr edit ${{ needs.triage.outputs.pr_num }} --remove-label '${{ env.E2E_LABEL}}' + - name: Checkout Pull Request env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -158,6 +174,13 @@ jobs: commentId: ${{ github.event.comment.id }} reaction: "+1" + - name: Remove label + id: remove + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr edit ${{ needs.triage.outputs.pr_num }} --add-label '${{ env.E2E_LABEL}}' + - name: React to comment with failure uses: dkershner6/reaction-action@v1 if: steps.test.outcome != 'success' diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c86e4a2e7c..4e61dbfeedd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,7 +52,7 @@ To learn more about our roadmap, we recommend reading [this document](ROADMAP.md ### Other -- TODO ([#XXX](https://github.com/kedacore/keda/issue/XXX)) +- **General:** Improve e2e on PR process. ([3004](https://github.com/kedacore/keda/issues/3004)) ## v2.7.1