diff --git a/.github/workflows/e2e-merge-queue-check.yml b/.github/workflows/e2e-merge-queue-check.yml new file mode 100644 index 00000000000..2dc762c5b7b --- /dev/null +++ b/.github/workflows/e2e-merge-queue-check.yml @@ -0,0 +1,32 @@ +name: E2E Merge Queue Check +on: + push: + branches: main + pull_request: + merge_group: + types: [checks_requested] + +jobs: + apply-smoke-label: + runs-on: ubuntu-latest + steps: + - name: Apply "Run Smoke E2E" label + uses: octokit/request-action@v2.x + with: + route: POST /repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels + labels: 'Run Smoke E2E' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + run-e2e-check: + uses: ./.github/workflows/bitrise-e2e-check.yml # Reuse the bitrise check workflow + with: + pr_number: ${{ github.event.number || github.event.pull_request.number }} + e2e_label: 'Run Smoke E2E' + e2e_pipeline: 'pr_smoke_e2e_pipeline' + secrets: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BITRISE_BUILD_TRIGGER_TOKEN: ${{ secrets.BITRISE_BUILD_TRIGGER_TOKEN }} + BITRISE_APP_ID: ${{ secrets.BITRISE_APP_ID }} + + \ No newline at end of file diff --git a/.github/workflows/run-bitrise-e2e-check.yml b/.github/workflows/run-bitrise-e2e-check.yml index ac1016e9d86..bdc0c005474 100644 --- a/.github/workflows/run-bitrise-e2e-check.yml +++ b/.github/workflows/run-bitrise-e2e-check.yml @@ -1,31 +1,46 @@ name: Run Bitrise E2E Check on: - issue_comment: - types: [edited, deleted] - pull_request: + workflow_call: # Allow workflow to be called by another workflow + inputs: + pr_number: + required: true + type: number + e2e_label: + required: true + type: string + default: 'Run Smoke E2E' + e2e_pipeline: + required: true + type: string + default: 'pr_smoke_e2e_pipeline' + secrets: + GITHUB_TOKEN: + required: true + BITRISE_BUILD_TRIGGER_TOKEN: + required: true + BITRISE_APP_ID: + required: true + + pull_request: # Allow workflow to be triggered directly on pull requests types: [opened, reopened, labeled, unlabeled, synchronize] env: E2E_LABEL: 'Run Smoke E2E' E2E_PIPELINE: 'pr_smoke_e2e_pipeline' - WORKFLOW_NAME: 'run-bitrise-e2e-check' jobs: is-fork-pull-request: name: Determine pull request source - if: ${{ github.event.issue.pull_request || github.event_name == 'pull_request' }} runs-on: ubuntu-latest outputs: IS_FORK: ${{ steps.is-fork.outputs.IS_FORK }} steps: - - uses: actions/checkout@v3 - name: Determine whether this PR is from a fork id: is-fork - run: echo "IS_FORK=$(gh pr view --json isCrossRepository --jq '.isCrossRepository' "${PR_NUMBER}" )" >> "$GITHUB_OUTPUT" + run: echo "IS_FORK=$(gh pr view --json isCrossRepository --jq '.isCrossRepository' "${{ inputs.pr_number || github.event.number }}" )" >> "$GITHUB_OUTPUT" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ github.event.number || github.event.issue.number }} run-bitrise-e2e-check: needs: is-fork-pull-request @@ -53,7 +68,5 @@ jobs: BITRISE_BUILD_TRIGGER_TOKEN: ${{ secrets.BITRISE_BUILD_TRIGGER_TOKEN }} BITRISE_APP_ID: ${{ secrets.BITRISE_APP_ID }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # The status check created under this workflow may be bucketed under another check suite in Github actions. This is a result of workflows with the same triggers. - # For example, the status check may show as `CLA Signature Bot / Bitrise E2E Status`. This is a bug on Github's UI. https://github.com/orgs/community/discussions/24616 run: yarn run run-bitrise-e2e-check working-directory: '.github/scripts'