|
1 | | -name: build |
| 1 | +name: Build repository |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_dispatch: |
5 | 5 | inputs: |
| 6 | + run_parallel: |
| 7 | + description: 'Run jobs in parallel' |
| 8 | + required: false |
| 9 | + type: boolean |
| 10 | + default: true |
| 11 | + self_hosted: |
| 12 | + description: 'Run on self-hosted runner' |
| 13 | + required: false |
| 14 | + type: boolean |
| 15 | + default: true |
6 | 16 | cypress: |
7 | 17 | description: 'Run cypress' |
8 | 18 | required: false |
9 | 19 | type: boolean |
10 | 20 | default: false |
| 21 | + playwright: |
| 22 | + description: 'Run playwright' |
| 23 | + required: false |
| 24 | + type: boolean |
| 25 | + default: false |
| 26 | + playwright_spec_param: |
| 27 | + type: string |
| 28 | + description: 'Run specific playwright test(s) (optional). Example: landing-page.spec.ts' |
| 29 | + required: false |
11 | 30 | push: |
| 31 | + pull_request: |
| 32 | + types: [opened, ready_for_review] |
| 33 | + pull_request_review: |
| 34 | + types: [submitted] |
12 | 35 |
|
13 | 36 | jobs: |
14 | 37 | build: |
| 38 | + if: ${{ github.event_name != 'pull_request_review' || github.event.review.state == 'approved' }} |
15 | 39 | uses: datavisyn/github-workflows/.github/workflows/build-node-python.yml@main |
16 | 40 | secrets: inherit |
| 41 | + # Boolean inputs are tricky in Github Actions. Their default is not honored in non-workflow-dispatch actions, so setting a default on push is tricky: https://stackoverflow.com/a/73495922 |
| 42 | + # To get on push true, use !contains(inputs.myInput, 'false') |
| 43 | + # To get on push false, use contains(inputs.myInput, 'true') |
17 | 44 | with: |
| 45 | + run_parallel: ${{ !contains(inputs.run_parallel, 'false') }} # true except if box is not checked |
| 46 | + runs_on: ${{ (!contains(inputs.self_hosted, 'false') && 'self-hosted') || null }} # self-hosted except if box is not checked |
18 | 47 | cypress_enable: true |
19 | | - cypress_run_because_flag: ${{ inputs.cypress == true }} |
| 48 | + cypress_run_because_flag: ${{ inputs.cypress == true || github.event_name == 'pull_request' || github.event.review.state == 'approved' }} |
| 49 | + cypress_runs_on: ${{ (!contains(inputs.self_hosted, 'false') && 'self-hosted') || null }} # self-hosted except if box is not checked |
| 50 | + playwright_enable: false |
| 51 | + playwright_run_because_flag: ${{ inputs.playwright == true || github.event_name == 'pull_request' || github.event.review.state == 'approved' }} |
| 52 | + playwright_spec_param: ${{ inputs.playwright_spec_param }} |
| 53 | + playwright_runs_on: ${{ (!contains(inputs.self_hosted, 'false') && 'self-hosted') || null }} # self-hosted except if box is not checked |
0 commit comments