Skip to content

Commit

Permalink
Trigger Circle CI workflows from github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperpeulen committed Nov 8, 2022
1 parent c18743d commit d483cb2
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 19 deletions.
8 changes: 0 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -498,14 +498,10 @@ workflows:
- react-vite-bench:
requires:
- build
## new workflow
- create-sandboxes:
parallelism: 9
requires:
- build
# - smoke-test-sandboxes: # disabled for now
# requires:
# - create-sandboxes
- build-sandboxes:
parallelism: 9
requires:
Expand Down Expand Up @@ -551,14 +547,10 @@ workflows:
- react-vite-bench:
requires:
- build
## new workflow
- create-sandboxes:
parallelism: 14
requires:
- build
# - smoke-test-sandboxes: # disabled for now
# requires:
# - create-sandboxes
- build-sandboxes:
parallelism: 14
requires:
Expand Down
65 changes: 54 additions & 11 deletions .github/workflows/trigger-circle-ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,63 @@ name: Trigger CircleCI workflow

on:
pull_request:
types: [labeled]
types: [opened, synchronize, labeled, unlabeled, reopened, converted_to_draft, ready_for_review]
push:

jobs:
trigger:
if: github.event.label.name == 'run e2e extended test suite' && github.event.pull_request.head.repo.fork == false
name: Run workflow with all e2e tests
trigger-ci-tests:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.pull_request.draft == true
steps:
- name: Make request to CircleCI
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Trigger draft PR tests
run: >
curl --request POST
--url https://circleci.com/api/v2/project/gh/storybookjs/storybook/pipeline
--header 'Circle-Token: '"$CIRCLE_CI_TOKEN"' '
--header 'content-type: application/json'
--data '{"branch":"${{ github.event.pull_request.head.ref }}"}'
npx trigger-circleci-pipeline --org storybookjs --project storybook \
--branch "${{ github.event.pull_request.head.ref }}" \
--parameters workflow=ci
env:
CIRCLE_CI_TOKEN: ${{ secrets.CIRCLE_CI_TOKEN }}
CIRCLE_CI_API_TOKEN: ${{ secrets.CIRCLE_CI_TOKEN }}
trigger-pr-tests:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && (github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'ci:pr') && !contains(github.event.pull_request.labels.*.name, 'ci:merged') && !contains(github.event.pull_request.labels.*.name, 'ci:daily'))
steps:
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Trigger PR tests
run: >
npx trigger-circleci-pipeline --org storybookjs --project storybook \
--branch "${{ github.event.pull_request.head.ref }}" \
--parameters workflow=pr
env:
CIRCLE_CI_API_TOKEN: ${{ secrets.CIRCLE_CI_TOKEN }}
trigger-merged-tests:
runs-on: ubuntu-latest
if: (github.event_name == 'push' && github.ref_name == 'kasper/debug-ci') || (contains(github.event.pull_request.labels.*.name, 'ci:merged') && !contains(github.event.pull_request.labels.*.name, 'ci:daily'))
steps:
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Trigger merged tests
run: >
npx trigger-circleci-pipeline --org storybookjs --project storybook \
--branch "${{ github.event.pull_request.head.ref || github.ref_name }}" \
--parameters workflow=merged
env:
CIRCLE_CI_API_TOKEN: ${{ secrets.CIRCLE_CI_TOKEN }}
trigger-daily-tests:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci:daily')
steps:
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Trigger the daily tests
run: >
npx trigger-circleci-pipeline --org storybookjs --project storybook \
--branch "${{ github.event.pull_request.head.ref }}" \
--parameters workflow=daily
env:
CIRCLE_CI_API_TOKEN: ${{ secrets.CIRCLE_CI_TOKEN }}

0 comments on commit d483cb2

Please sign in to comment.