From dbd9866189fb212810553cb13bb01ce67a9cab71 Mon Sep 17 00:00:00 2001 From: Mads Bisgaard Date: Tue, 11 Mar 2025 11:25:57 +0100 Subject: [PATCH 1/3] add workflow_dispatch trigger to PR CI workflows --- .github/workflows/ci-testing-pull-request.yml | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-testing-pull-request.yml b/.github/workflows/ci-testing-pull-request.yml index 289c9878367d..f783db26346f 100644 --- a/.github/workflows/ci-testing-pull-request.yml +++ b/.github/workflows/ci-testing-pull-request.yml @@ -10,6 +10,20 @@ on: branches: - "master" + workflow_dispatch: + inputs: + target_repo: + description: full repository name (e.g. 'ITISFoundation/osparc-simcore') to check backwards compatibility against + required: true + default: "ITISFoundation/osparc-simcore" + type: environment + target_branch: + description: branch name (e.g. 'master') to check backwards compatibility against + required: true + default: "master" + type: environment + + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -39,7 +53,7 @@ jobs: - name: Check openapi specs are up to date run: | if ! ./ci/github/helpers/openapi-specs-diff.bash diff \ - https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name }}/${{ github.event.pull_request.head.sha }} \ + "https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_SHA" \ .; then \ echo "::error:: OAS are not up to date. Run 'make openapi-specs' to update them"; exit 1; \ fi @@ -59,8 +73,11 @@ jobs: - name: check api-server backwards compatibility run: | ./scripts/openapi-diff.bash breaking --fail-on ERR\ - https://raw.githubusercontent.com/${{ github.event.pull_request.base.repo.full_name }}/refs/heads/${{ github.base_ref }}/services/api-server/openapi.json \ + "https://raw.githubusercontent.com/$REPO/refs/heads/$BRANCH/services/api-server/openapi.json" \ /specs/services/api-server/openapi.json + env: + REPO: ${{ github.event.pull_request.base.repo.full_name }} if ${{ github.event_name == 'pull_request' }} else ${{ inputs.target_repo }} + BRANCH: ${{ github.base_ref }} if ${{ github.event_name == 'pull_request' }} else ${{ inputs.target_branch }} all-oas-breaking: needs: api-specs @@ -78,5 +95,8 @@ jobs: - name: Check openapi-specs backwards compatibility run: | ./ci/github/helpers/openapi-specs-diff.bash breaking \ - https://raw.githubusercontent.com/${{ github.event.pull_request.base.repo.full_name }}/refs/heads/${{ github.base_ref }} \ + "https://raw.githubusercontent.com/$REPO/refs/heads/$BRANCH" \ . + env: + REPO: ${{ github.event.pull_request.base.repo.full_name }} if ${{ github.event_name == 'pull_request' }} else ${{ inputs.target_repo }} + BRANCH: ${{ github.base_ref }} if ${{ github.event_name == 'pull_request' }} else ${{ inputs.target_branch }} From 3a394441082ac58d75508a47135aaebd043438e3 Mon Sep 17 00:00:00 2001 From: Mads Bisgaard Date: Tue, 11 Mar 2025 11:38:12 +0100 Subject: [PATCH 2/3] set env vars in a different section --- .github/workflows/ci-testing-pull-request.yml | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-testing-pull-request.yml b/.github/workflows/ci-testing-pull-request.yml index f783db26346f..8ec5a018c529 100644 --- a/.github/workflows/ci-testing-pull-request.yml +++ b/.github/workflows/ci-testing-pull-request.yml @@ -70,14 +70,20 @@ jobs: python-version: "3.11" - name: checkout uses: actions/checkout@v4 + - name: Set environment variables based on event type + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "REPO=${{ inputs.target_repo }}" >> $GITHUB_ENV + echo "BRANCH=${{ inputs.target_branch }}" >> $GITHUB_ENV + else + echo "REPO=${{ github.event.pull_request.base.repo.full_name }}" >> $GITHUB_ENV + echo "BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + fi - name: check api-server backwards compatibility run: | ./scripts/openapi-diff.bash breaking --fail-on ERR\ "https://raw.githubusercontent.com/$REPO/refs/heads/$BRANCH/services/api-server/openapi.json" \ /specs/services/api-server/openapi.json - env: - REPO: ${{ github.event.pull_request.base.repo.full_name }} if ${{ github.event_name == 'pull_request' }} else ${{ inputs.target_repo }} - BRANCH: ${{ github.base_ref }} if ${{ github.event_name == 'pull_request' }} else ${{ inputs.target_branch }} all-oas-breaking: needs: api-specs @@ -92,11 +98,17 @@ jobs: python-version: "3.11" - name: checkout uses: actions/checkout@v4 + - name: Set environment variables based on event type + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "REPO=${{ inputs.target_repo }}" >> $GITHUB_ENV + echo "BRANCH=${{ inputs.target_branch }}" >> $GITHUB_ENV + else + echo "REPO=${{ github.event.pull_request.base.repo.full_name }}" >> $GITHUB_ENV + echo "BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + fi - name: Check openapi-specs backwards compatibility run: | ./ci/github/helpers/openapi-specs-diff.bash breaking \ "https://raw.githubusercontent.com/$REPO/refs/heads/$BRANCH" \ . - env: - REPO: ${{ github.event.pull_request.base.repo.full_name }} if ${{ github.event_name == 'pull_request' }} else ${{ inputs.target_repo }} - BRANCH: ${{ github.base_ref }} if ${{ github.event_name == 'pull_request' }} else ${{ inputs.target_branch }} From 0194657b29cab6b6768b8652e4fb2f67be29486c Mon Sep 17 00:00:00 2001 From: Mads Bisgaard Date: Wed, 12 Mar 2025 11:20:27 +0100 Subject: [PATCH 3/3] improve inputs descriptions @pcrespov --- .github/workflows/ci-testing-pull-request.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-testing-pull-request.yml b/.github/workflows/ci-testing-pull-request.yml index 8ec5a018c529..5090a6e3f472 100644 --- a/.github/workflows/ci-testing-pull-request.yml +++ b/.github/workflows/ci-testing-pull-request.yml @@ -13,12 +13,12 @@ on: workflow_dispatch: inputs: target_repo: - description: full repository name (e.g. 'ITISFoundation/osparc-simcore') to check backwards compatibility against + description: full repository name (e.g. 'ITISFoundation/osparc-simcore') required: true default: "ITISFoundation/osparc-simcore" type: environment target_branch: - description: branch name (e.g. 'master') to check backwards compatibility against + description: Check backwards compatibility against target_branch in target_repo required: true default: "master" type: environment