Skip to content

Commit

Permalink
add merge queue check for e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
cortisiko committed Oct 11, 2024
1 parent ede7fe3 commit a5cb178
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 10 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/e2e-merge-queue-check.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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 }}


33 changes: 23 additions & 10 deletions .github/workflows/run-bitrise-e2e-check.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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'

0 comments on commit a5cb178

Please sign in to comment.