Skip to content

Commit 213a191

Browse files
mads-hartmannroboquat
authored andcommitted
Trigger workflow after successful main builds
1 parent 88fab6c commit 213a191

File tree

1 file changed

+41
-5
lines changed

1 file changed

+41
-5
lines changed

.github/workflows/preview-env-check-regressions.yml

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: "Preview environment regression check"
22
on:
3+
workflow_run:
4+
workflows: ["Build"]
5+
types: [completed]
6+
branches: ["main"]
37
workflow_dispatch:
48
inputs:
59
name:
@@ -13,24 +17,56 @@ on:
1317
required: false
1418
default: harvester
1519
jobs:
20+
configuration:
21+
name: Configuration
22+
runs-on: [self-hosted]
23+
outputs:
24+
skip: ${{ steps.configuration.outputs.skip }}
25+
name: ${{ steps.configuration.outputs.name }}
26+
version: ${{ steps.configuration.outputs.version }}
27+
infrastructure_provider: ${{ steps.configuration.outputs.infrastructure_provider }}
28+
steps:
29+
- name: "Set outputs"
30+
id: configuration
31+
run: |
32+
if [[ '${{ github.event.inputs.name }}' != '' ]]; then
33+
# The workflow was triggered by workflow_dispatch
34+
{
35+
echo "version=${{ github.event.inputs.version }}"
36+
echo "name=${{ github.event.inputs.name }}"
37+
echo "infrastructure_provider=${{ github.event.inputs.infrastructure_provider }}"
38+
echo "skip=false"
39+
} >> $GITHUB_OUTPUT
40+
else
41+
# The workflow was triggered by workflow_run
42+
{
43+
echo "version=main-gha.${{ github.event.workflow_run.run_number }}"
44+
echo "name=preview-regression-check-main-${{ github.run_id }}-${{ github.run_attempt }}"
45+
echo "infrastructure_provider=harvester"
46+
echo "skip=${{ github.event.workflow_run.conclusion == 'failure' }}"
47+
} >> $GITHUB_OUTPUT
48+
fi
1649
check:
1750
name: Check for regressions
51+
needs: [configuration]
52+
if: ${{ needs.configuration.outputs.skip == 'false' }}
1853
runs-on: [self-hosted]
1954
steps:
2055
- uses: actions/checkout@v3
2156
- name: Create preview environment infrastructure
2257
uses: ./.github/actions/preview-create
2358
with:
24-
name: ${{ github.event.inputs.name }}
25-
infrastructure_provider: ${{ github.event.inputs.infrastructure_provider }}
59+
name: ${{ needs.configuration.outputs.name }}
60+
infrastructure_provider: ${{ needs.configuration.outputs.infrastructure_provider }}
61+
large_vm: false
2662
sa_key: ${{ secrets.GCP_CREDENTIALS }}
2763
- name: Deploy Gitpod to the preview environment
2864
id: deploy-gitpod
2965
uses: ./.github/actions/deploy-gitpod
3066
with:
31-
name: ${{ github.event.inputs.name }}
67+
name: ${{ needs.configuration.outputs.name }}
3268
sa_key: ${{ secrets.GCP_CREDENTIALS }}
33-
version: ${{ github.event.inputs.version}}
69+
version: ${{ needs.configuration.outputs.version}}
3470
- name: Check
3571
run: |
3672
echo "No regressions caught because I didn't check anything 🤡 Sleeping for 2 minutes."
@@ -39,5 +75,5 @@ jobs:
3975
if: always()
4076
uses: ./.github/actions/delete-preview
4177
with:
42-
name: ${{ github.event.inputs.name }}
78+
name: ${{ needs.configuration.outputs.name }}
4379
sa_key: ${{ secrets.GCP_CREDENTIALS }}

0 commit comments

Comments
 (0)