Skip to content

Commit c3969de

Browse files
committed
Allow manual triggering with a specific environment
1 parent 9862f08 commit c3969de

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

.github/workflows/main.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
on:
23
push:
34
branches:
@@ -6,11 +7,18 @@ on:
67
merge_group:
78
schedule:
89
- cron: '0 0 * * *' # Every day at midnight UTC
9-
10+
# allow manual triggering with a given environment
11+
workflow_dispatch:
12+
inputs:
13+
ENVIRONMENT:
14+
required: true
15+
type: environment
1016
name: CI
1117
jobs:
1218

1319
test:
20+
environment:
21+
name: ${{ vars.ENVIRONMENT }}
1422
runs-on: ubuntu-latest
1523
steps:
1624
- name: Check out source code
@@ -34,6 +42,8 @@ jobs:
3442
run: pdm run test-docs
3543

3644
license:
45+
environment:
46+
name: ${{ vars.ENVIRONMENT}}
3747
runs-on: ubuntu-latest
3848
steps:
3949
- name: Check out source code
@@ -48,5 +58,7 @@ jobs:
4858
with:
4959
CHIPFLOW_API_ORIGIN: ${{ vars.CHIPFLOW_API_ORIGIN }}
5060
CHIPFLOW_BACKEND_VERSION: ${{ vars.CHIPFLOW_BACKEND_VERSION }}
61+
ENVIRONMENT: ${{ vars.ENVIRONMENT }}
5162
secrets:
5263
CHIPFLOW_API_KEY: ${{ secrets.CHIPFLOW_API_KEY}}
64+

.github/workflows/test-examples.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@ on:
88
inputs:
99
CHIPFLOW_API_ORIGIN:
1010
required: true
11+
type: string
1112
CHIPFLOW_BACKEND_VERSION:
1213
required: true
14+
type: string
15+
ENVIRONMENT:
16+
required: true
17+
type: string
1318

1419

1520
jobs:
1621
test-submit:
1722
runs-on: ubuntu-latest
23+
environment: ${{ vars.ENVIRONMENT }}
1824
strategy:
1925
matrix:
2026
dry: [true, false]
@@ -24,7 +30,7 @@ jobs:
2430
env:
2531
DRY: ${{ matrix.dry && '--dry-run' || '' }}
2632
is_dry: ${{ matrix.dry && '(dry run)' || '' }}
27-
our_path: "${{ github.workspace}}/${{ github.repo }}"
33+
our_path: ${{ github.workspace}}
2834
test_repo_path: "${{ github.workspace }}/${{ matrix.repo.name }}"
2935

3036
name: ${{ matrix.dry && 'Test Submit - Dry run' || 'Test submit' }}
@@ -45,20 +51,23 @@ jobs:
4551
id: check-head-ref
4652
working-directory: ${{ env.test_repo_path }}
4753
if: github.event_name == 'pull_request'
54+
env:
55+
HEAD_REF: ${{ github.head_ref }}
56+
BASE_REF: ${{ github.base_ref }}
4857
run: |
4958
git remote update
50-
if git checkout ${{ github.head_ref }}; then
51-
echo "Using branch ${{github.head_ref}}"
59+
if git checkout $HEAD_REF; then
60+
echo "Using branch $HEAD_REF"
5261
echo "found-branch=1\n" >> $GITHUB_OUTPUT
5362
else
54-
echo "${{github.head_ref}} not found, checking base ${{github.base_ref}}"
63+
echo "$HEAD_REF not found, checking base $BASE_REF"
5564
echo "found-branch=0\n" >> $GITHUB_OUTPUT
5665
fi
5766
5867
- name: Check for branch ${{ github.base_ref }}
5968
id: check-base-ref
6069
working-directory: ${{ env.test_repo_path }}x
61-
if: github.event_name == 'pull_request' && steps.check-head-ref == 0
70+
if: github.event_name == 'pull_request' && steps.check-head-ref.outputs.found-branch == '0'
6271
run: |
6372
git remote update
6473
if git checkout ${{ github.base_ref }}; then

0 commit comments

Comments
 (0)