Skip to content

Commit 82d5d44

Browse files
authored
Run integration tests on main/tags (#2)
1 parent 38927c8 commit 82d5d44

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

.github/workflows/integration-tests.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ on:
44
pull_request:
55
paths:
66
- "action.yaml"
7+
- ".github/workflows/target-workflow.yaml"
8+
- ".github/workflows/integration-tests.yaml"
9+
push:
10+
branches: ["main"]
11+
tags: ["*"]
12+
paths:
13+
- "action.yaml"
14+
- ".github/workflows/target-workflow.yaml"
715
- ".github/workflows/integration-tests.yaml"
816

917
jobs:
@@ -66,8 +74,23 @@ jobs:
6674
job_id: ${{ steps.wait-for-job-named.outputs.job-id }}
6775
conclusion: ${{ steps.wait-for-job-named.outputs.conclusion }}
6876

77+
setup-build-workflow:
78+
name: Setup Build Workflow
79+
# These permissions are needed to:
80+
# - Create a workflow dispatch event: https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event
81+
permissions:
82+
actions: write
83+
runs-on: ubuntu-latest
84+
steps:
85+
- name: Initiate target workflow
86+
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4
87+
with:
88+
workflow: target-workflow.yaml
89+
ref: ${{ github.head_ref || github.ref_name }} # Workflow dispatch only works on branches or tags
90+
6991
test-build-workflow:
7092
name: Test Build Workflow
93+
needs: setup-build-workflow
7194
# These permissions are needed to:
7295
# - Checkout the repo
7396
permissions:
@@ -79,7 +102,7 @@ jobs:
79102
id: workflow-run
80103
with:
81104
workflow-file: target-workflow.yaml
82-
commit-sha: ${{ github.event.pull_request.head.sha }}
105+
commit-sha: ${{ github.event.pull_request.head.sha || github.sha }}
83106
- uses: ./
84107
id: wait-for-job
85108
with:

.github/workflows/target-workflow.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
---
22
name: Target Workflow
33
on:
4-
pull_request:
5-
paths:
6-
- "action.yaml"
7-
- ".github/workflows/integration-tests.yaml"
4+
workflow_dispatch: {}
85

96
jobs:
107
build:

0 commit comments

Comments
 (0)