Skip to content

Commit

Permalink
put logic in all-jobs-pass workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cortisiko committed Oct 12, 2024
1 parent 4a03b4b commit c60935b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 23 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@ on:
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/run-bitrise-e2e-check.yml
with:
E2E_LABEL: 'Run Smoke E2E'
E2E_PIPELINE: 'pr_smoke_e2e_pipeline'
secrets:
BITRISE_BUILD_TRIGGER_TOKEN: ${{ secrets.BITRISE_BUILD_TRIGGER_TOKEN }}
BITRISE_APP_ID: ${{ secrets.BITRISE_APP_ID }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

check-diff:
runs-on: macos-latest
steps:
Expand Down Expand Up @@ -300,6 +320,7 @@ jobs:
needs:
[
check-diff,
run-e2e-check,
dedupe,
scripts,
unit-tests,
Expand Down
41 changes: 18 additions & 23 deletions .github/workflows/run-bitrise-e2e-check.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,39 @@
name: Run Bitrise E2E Check

on:
workflow_call: # Allow workflow to be called by another workflow
inputs:
pr_number:
issue_comment:
types: [edited, deleted]
pull_request:
types: [opened, reopened, labeled, unlabeled, synchronize]
workflow_call:
inputs:
E2E_LABEL:
required: true
type: number
e2e_label:
required: false
type: string
default: 'Run Smoke E2E'
e2e_pipeline:
required: false
type: string
default: 'pr_smoke_e2e_pipeline'
secrets:
GITHUB_TOKEN:
required: true
BITRISE_BUILD_TRIGGER_TOKEN:
E2E_PIPELINE:
required: true
BITRISE_APP_ID:
required: true

pull_request: # Allow workflow to be triggered directly on pull requests
types: [opened, reopened, labeled, unlabeled, synchronize]

type: string

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' "${{ inputs.pr_number || github.event.number }}" )" >> "$GITHUB_OUTPUT"
run: echo "IS_FORK=$(gh pr view --json isCrossRepository --jq '.isCrossRepository' "${PR_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 @@ -68,5 +61,7 @@ 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'
working-directory: '.github/scripts'

0 comments on commit c60935b

Please sign in to comment.