Skip to content

Commit 854ebb8

Browse files
bisgaard-itismrnicegyu11
authored andcommitted
Add workflow_dispatch trigger to PR CI workflows (ITISFoundation#7340)
On behalf of @bisgaard-itis
1 parent fd190cd commit 854ebb8

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

.github/workflows/ci-testing-pull-request.yml

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ on:
1010
branches:
1111
- "master"
1212

13+
workflow_dispatch:
14+
inputs:
15+
target_repo:
16+
description: full repository name (e.g. 'ITISFoundation/osparc-simcore')
17+
required: true
18+
default: "ITISFoundation/osparc-simcore"
19+
type: environment
20+
target_branch:
21+
description: Check backwards compatibility against target_branch in target_repo
22+
required: true
23+
default: "master"
24+
type: environment
25+
26+
1327
concurrency:
1428
group: ${{ github.workflow }}-${{ github.ref }}
1529
cancel-in-progress: true
@@ -39,7 +53,7 @@ jobs:
3953
- name: Check openapi specs are up to date
4054
run: |
4155
if ! ./ci/github/helpers/openapi-specs-diff.bash diff \
42-
https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name }}/${{ github.event.pull_request.head.sha }} \
56+
"https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_SHA" \
4357
.; then \
4458
echo "::error:: OAS are not up to date. Run 'make openapi-specs' to update them"; exit 1; \
4559
fi
@@ -56,10 +70,19 @@ jobs:
5670
python-version: "3.11"
5771
- name: checkout
5872
uses: actions/checkout@v4
73+
- name: Set environment variables based on event type
74+
run: |
75+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
76+
echo "REPO=${{ inputs.target_repo }}" >> $GITHUB_ENV
77+
echo "BRANCH=${{ inputs.target_branch }}" >> $GITHUB_ENV
78+
else
79+
echo "REPO=${{ github.event.pull_request.base.repo.full_name }}" >> $GITHUB_ENV
80+
echo "BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV
81+
fi
5982
- name: check api-server backwards compatibility
6083
run: |
6184
./scripts/openapi-diff.bash breaking --fail-on ERR\
62-
https://raw.githubusercontent.com/${{ github.event.pull_request.base.repo.full_name }}/refs/heads/${{ github.base_ref }}/services/api-server/openapi.json \
85+
"https://raw.githubusercontent.com/$REPO/refs/heads/$BRANCH/services/api-server/openapi.json" \
6386
/specs/services/api-server/openapi.json
6487
6588
all-oas-breaking:
@@ -75,8 +98,17 @@ jobs:
7598
python-version: "3.11"
7699
- name: checkout
77100
uses: actions/checkout@v4
101+
- name: Set environment variables based on event type
102+
run: |
103+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
104+
echo "REPO=${{ inputs.target_repo }}" >> $GITHUB_ENV
105+
echo "BRANCH=${{ inputs.target_branch }}" >> $GITHUB_ENV
106+
else
107+
echo "REPO=${{ github.event.pull_request.base.repo.full_name }}" >> $GITHUB_ENV
108+
echo "BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV
109+
fi
78110
- name: Check openapi-specs backwards compatibility
79111
run: |
80112
./ci/github/helpers/openapi-specs-diff.bash breaking \
81-
https://raw.githubusercontent.com/${{ github.event.pull_request.base.repo.full_name }}/refs/heads/${{ github.base_ref }} \
113+
"https://raw.githubusercontent.com/$REPO/refs/heads/$BRANCH" \
82114
.

0 commit comments

Comments
 (0)