Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[GHA] Avoid running actions in forks (#26749)

Alina Kladievaa17efa6f20ec
diff --git a/.github/actions/smart-ci/action.yml b/.github/actions/smart-ci/action.yml
index 007db90d132..cd111d617dd 100644
--- a/.github/actions/smart-ci/action.yml
+++ b/.github/actions/smart-ci/action.yml
@@ -43,6 +43,10 @@ inputs:
description: "Comma-separated list of patterns (fnmatch-style). If PR has only matching files changed,
return indicator that CI can be skipped"
required: false
+ enable_for_org:
+ description: "Enables running workflows for a given organization; triggers from other orgs are skipped"
+ required: false
+ default: "openvinotoolkit"
outputs:
all_components:
@@ -99,6 +103,7 @@ runs:
-c "${{ inputs.components_config }}" \
-m "${{ inputs.components_config_schema }}" \
-l "${{ inputs.labeler_config }}" \
+ --enable_for_org "${{ inputs.enable_for_org }}" \
--skip-when-only-listed-labels-set "${{ inputs.skip_when_only_listed_labels_set }}" \
--skip-when-only-listed-files-changed "${{ inputs.skip_when_only_listed_files_changed }}"
shell: bash
diff --git a/.github/actions/smart-ci/smart_ci.py b/.github/actions/smart-ci/smart_ci.py
index 1c8558f4779..e922d3d2ef5 100644
--- a/.github/actions/smart-ci/smart_ci.py
+++ b/.github/actions/smart-ci/smart_ci.py
@@ -4,6 +4,8 @@
import os
import re
import argparse
+import sys
+
import yaml
import json
import jsonschema
@@ -146,6 +148,8 @@ def parse_args():
parser.add_argument('--skip-when-only-listed-files-changed',
help="Comma-separated list of patterns (fnmatch-style). If PR has only matching files changed, "
"return indicator that CI can be skipped")
+ parser.add_argument('--enable_for_org', default='openvinotoolkit',
+ help='Enable running workflows for a given organization; triggers from other orgs are skipped')
args = parser.parse_args()
return args
@@ -176,6 +180,13 @@ def main():
components_config = yaml.safe_load(config)
owner, repository = args.repo.split('/')
+
+ if owner != args.enable_for_org:
+ logger.info(f"Running workflows is enabled only for repos in {args.enable_for_org} organization. "
+ f"The current workflow was initiated from other org: {owner}, skipping")
+ set_github_output("skip_workflow", "True")
+ sys.exit(0)
+
gh_api = GhApi(owner=owner, repo=repository, token=os.getenv("GITHUB_TOKEN"))
pr = gh_api.pulls.get(args.pr) if args.pr else None
diff --git a/.github/workflows/android_arm64.yml b/.github/workflows/android_arm64.yml
index 35c18b43e1f..bbd737dff0e 100644
--- a/.github/workflows/android_arm64.yml
+++ b/.github/workflows/android_arm64.yml
@@ -43,6 +43,7 @@ jobs:
Docker:
needs: Smart_CI
+ if: "!needs.smart_ci.outputs.skip_workflow"
runs-on: aks-linux-4-cores-16gb-docker-build
container:
image: openvinogithubactions.azurecr.io/docker_build:0.2
@@ -95,7 +96,6 @@ jobs:
VCPKG_DEFAULT_BINARY_CACHE: '/mount/caches/ccache/android_arm64/vcpkg_cache'
VCPKG_FORCE_SYSTEM_BINARIES: '1'
SCCACHE_AZURE_KEY_PREFIX: android_arm64
- if: "!needs.smart_ci.outputs.skip_workflow"
steps:
- name: Clone OpenVINO
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
diff --git a/.github/workflows/android_x64.yml b/.github/workflows/android_x64.yml
index e8fb4902e37..3504b8cf2fd 100644
--- a/.github/workflows/android_x64.yml
+++ b/.github/workflows/android_x64.yml
@@ -46,6 +46,7 @@ jobs:
Docker:
needs: Smart_CI
+ if: "!needs.smart_ci.outputs.skip_workflow"
runs-on: aks-linux-4-cores-16gb-docker-build
container:
image: openvinogithubactions.azurecr.io/docker_build:0.2
@@ -94,7 +95,6 @@ jobs:
ANDROID_SDK_VERSION: 29
ANDROID_ABI_CONFIG: x86_64
SCCACHE_AZURE_KEY_PREFIX: android_x64
- if: "!needs.smart_ci.outputs.skip_workflow"
steps:
- name: Clone OpenVINO
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
diff --git a/.github/workflows/assign_issue.yml b/.github/workflows/assign_issue.yml
index f466715f5cf..b13c6736e27 100644
--- a/.github/workflows/assign_issue.yml
+++ b/.github/workflows/assign_issue.yml
@@ -15,6 +15,7 @@ jobs:
permissions:
issues: write
timeout-minutes: 10
+ if: ${{ github.repository_owner == 'openvinotoolkit' }}
steps:
- name: take an issue
uses: bdougie/take-action@1439165ac45a7461c2d89a59952cd7d941964b87 # v1.6.1
diff --git a/.github/workflows/build_doc.yml b/.github/workflows/build_doc.yml
index 7b380530cfa..d6d3a63e431 100644
--- a/.github/workflows/build_doc.yml
+++ b/.github/workflows/build_doc.yml
@@ -15,6 +15,7 @@ permissions: read-all
jobs:
Build_Doc:
runs-on: ubuntu-20.04
+ if: ${{ github.repository_owner == 'openvinotoolkit' }}
steps:
- name: Clone OpenVINO
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
diff --git a/.github/workflows/check_pr_commits.yml b/.github/workflows/check_pr_commits.yml
index 75d18695c6e..690b85046a1 100644
--- a/.github/workflows/check_pr_commits.yml
+++ b/.github/workflows/check_pr_commits.yml
@@ -6,6 +6,7 @@ permissions: read-all
jobs:
Checks:
runs-on: ubuntu-22.04
+ if: ${{ github.repository_owner == 'openvinotoolkit' }}
steps:
- name: Clone OpenVINO
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
diff --git a/.github/workflows/cleanup_caches.yml b/.github/workflows/cleanup_caches.yml
index 6ba1a4164d9..9c3992e2a85 100644
--- a/.github/workflows/cleanup_caches.yml
+++ b/.github/workflows/cleanup_caches.yml
@@ -10,6 +10,7 @@ permissions: read-all
jobs:
Cleanup_PIP:
runs-on: aks-linux-2-cores-8gb
+ if: ${{ github.repository_owner == 'openvinotoolkit' }}
container:
image: openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04
volumes:
@@ -35,6 +36,7 @@ jobs:
Cleanup_CCACHE:
runs-on: aks-linux-2-cores-8gb
+ if: ${{ github.repository_owner == 'openvinotoolkit' }}
container:
image: openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04
volumes:
diff --git a/.github/workflows/code_snippets.yml b/.github/workflows/code_snippets.yml
index ae5f9ee2562..82daec9ee79 100644
--- a/.github/workflows/code_snippets.yml
+++ b/.github/workflows/code_snippets.yml
@@ -25,6 +25,7 @@ jobs:
matrix:
os: ['ubuntu-22.04', 'macos-latest', 'windows-latest']
runs-on: ${{ matrix.os }}
+ if: ${{ github.repository_owner == 'openvinotoolkit' }}
steps:
- name: Clone OpenVINO
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
diff --git a/.github/workflows/code_style.yml b/.github/workflows/code_style.yml
index 2fbcc6b5f87..c2db68edca3 100644
--- a/.github/workflows/code_style.yml
+++ b/.github/workflows/code_style.yml
@@ -12,6 +12,7 @@ jobs:
runs-on: ubuntu-22.04
permissions:
pull-requests: write
+ if: ${{ github.repository_owner == 'openvinotoolkit' }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml
index 1d2f8e3ff54..0de4cb045bf 100644
--- a/.github/workflows/coverity.yml
+++ b/.github/workflows/coverity.yml
@@ -31,6 +31,7 @@ jobs:
run:
shell: bash
runs-on: aks-linux-16-cores-32gb
+ if: ${{ github.repository_owner == 'openvinotoolkit' }}
container:
image: openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04
env:
diff --git a/.github/workflows/debian_10_arm.yml b/.github/workflows/debian_10_arm.yml
index 84496a50b9a..7fab775b45b 100644
--- a/.github/workflows/debian_10_arm.yml
+++ b/.github/workflows/debian_10_arm.yml
@@ -48,6 +48,7 @@ jobs:
Docker:
needs: Smart_CI
+ if: "!needs.smart_ci.outputs.skip_workflow"
runs-on: aks-linux-16-cores-arm-docker-build
container:
image: openvinogithubactions.azurecr.io/docker_build:0.2
diff --git a/.github/workflows/dependency_review.yml b/.github/workflows/dependency_review.yml
index fd2d4f02d57..e73acd765ed 100644
--- a/.github/workflows/dependency_review.yml
+++ b/.github/workflows/dependency_review.yml
@@ -6,6 +6,7 @@ permissions: read-all
jobs:
dependency-review:
runs-on: ubuntu-latest
+ if: ${{ github.repository_owner == 'openvinotoolkit' }}
steps:
- name: Clone OpenVINO
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
diff --git a/.github/workflows/fedora_29.yml b/.github/workflows/fedora_29.yml
index a79b0f86af2..b3a540fb287 100644
--- a/.github/workflows/fedora_29.yml
+++ b/.github/workflows/fedora_29.yml
@@ -48,6 +48,7 @@ jobs:
Docker:
needs: Smart_CI
+ if: "!needs.smart_ci.outputs.skip_workflow"
runs-on: aks-linux-4-cores-16gb-docker-build
container:
image: openvinogithubactions.azurecr.io/docker_build:0.2
@@ -71,7 +72,6 @@ jobs:
Build:
needs: [Docker, Smart_CI]
- if: "!needs.smart_ci.outputs.skip_workflow"
uses: ./.github/workflows/job_build_linux.yml
with:
runner: 'aks-linux-16-cores-32gb'
diff --git a/.github/workflows/files_size.yml b/.github/workflows/files_size.yml
index 065fe71bc75..6a006cc7d4a 100644
--- a/.github/workflows/files_size.yml
+++ b/.github/workflows/files_size.yml
@@ -10,6 +10,7 @@ permissions: read-all
jobs:
Check_Files_Size:
runs-on: ubuntu-22.04
+ if: ${{ github.repository_owner == 'openvinotoolkit' }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
diff --git a/.github/workflows/linux_arm64.yml b/.github/workflows/linux_arm64.yml
index 7c0282b5519..2e557ebc5ef 100644
--- a/.github/workflows/linux_arm64.yml
+++ b/.github/workflows/linux_arm64.yml
@@ -52,6 +52,7 @@ jobs:
Docker:
needs: Smart_CI
+ if: "!needs.smart_ci.outputs.skip_workflow"
runs-on: aks-linux-16-cores-arm-docker-build
container:
image: openvinogithubactions.azurecr.io/docker_build:0.2
@@ -75,7 +76,6 @@ jobs:
Build:
needs: [ Docker, Smart_CI ]
- if: "!needs.smart_ci.outputs.skip_workflow"
uses: ./.github/workflows/job_build_linux.yml
with:
runner: 'aks-linux-16-cores-arm'
diff --git a/.github/workflows/linux_conditional_compilation.yml b/.github/workflows/linux_conditional_compilation.yml
index f0ce141e8c0..f9359e323d4 100644
--- a/.github/workflows/linux_conditional_compilation.yml
+++ b/.github/workflows/linux_conditional_compilation.yml
@@ -53,6 +53,7 @@ jobs:
Docker:
needs: Smart_CI
+ if: "!needs.smart_ci.outputs.skip_workflow"
runs-on: aks-linux-4-cores-16gb-docker-build
container:
image: openvinogithubactions.azurecr.io/docker_build:0.2
@@ -104,7 +105,7 @@ jobs:
SELECTIVE_BUILD_STAT_DIR: /__w/openvino/openvino/selective_build_stat
MODELS_PATH: /__w/openvino/openvino/testdata
SCCACHE_AZURE_KEY_PREFIX: ubuntu22_x86_64_itt_clang_Release_faster_build
- if: ${{ !needs.smart_ci.outputs.skip_workflow && github.event_name != 'merge_group' }}
+ if: ${{ github.event_name != 'merge_group' }}
steps:
- name: Clone OpenVINO
diff --git a/.github/workflows/linux_riscv.yml b/.github/workflows/linux_riscv.yml
index 6c26bb8b385..3de8b56ad77 100644
--- a/.github/workflows/linux_riscv.yml
+++ b/.github/workflows/linux_riscv.yml
@@ -44,6 +44,7 @@ jobs:
Docker:
needs: Smart_CI
runs-on: aks-linux-4-cores-16gb-docker-build
+ if: "!needs.smart_ci.outputs.skip_workflow"
container:
image: openvinogithubactions.azurecr.io/docker_build:0.2
volumes:
@@ -88,7 +89,7 @@ jobs:
CCACHE_TEMPDIR: /__w/openvino/openvino/ccache_temp
CCACHE_MAXSIZE: 2G
- if: ${{ !needs.smart_ci.outputs.skip_workflow && github.event_name != 'merge_group' }}
+ if: ${{ github.event_name != 'merge_group' }}
steps:
- name: Clone OpenVINO
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
diff --git a/.github/workflows/linux_sanitizers.yml b/.github/workflows/linux_sanitizers.yml
index 9105b3b00bf..367fce8eb98 100644
--- a/.github/workflows/linux_sanitizers.yml
+++ b/.github/workflows/linux_sanitizers.yml
@@ -25,6 +25,7 @@ jobs:
run:
shell: bash
runs-on: aks-linux-16-cores-32gb
+ if: ${{ github.repository_owner == 'openvinotoolkit' }}
container:
image: openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04
volumes:
diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml
index 715380811d6..d60ef460809 100644
--- a/.github/workflows/mac.yml
+++ b/.github/workflows/mac.yml
@@ -78,6 +78,7 @@ jobs:
INSTALL_DIR_JS: ${{ github.workspace }}/openvino_install/js
INSTALL_TEST_DIR: ${{ github.workspace }}/tests_install
BUILD_DIR: ${{ github.workspace }}/build
+ if: "!needs.smart_ci.outputs.skip_workflow"
steps:
- name: Clone OpenVINO
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
diff --git a/.github/workflows/mac_arm64.yml b/.github/workflows/mac_arm64.yml
index 2615fe16316..73890d12842 100644
--- a/.github/workflows/mac_arm64.yml
+++ b/.github/workflows/mac_arm64.yml
@@ -78,6 +78,7 @@ jobs:
INSTALL_DIR_JS: ${{ github.workspace }}/openvino_install/js
INSTALL_TEST_DIR: ${{ github.workspace }}/tests_install
BUILD_DIR: ${{ github.workspace }}/build
+ if: "!needs.smart_ci.outputs.skip_workflow"
steps:
- name: Clone OpenVINO
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
diff --git a/.github/workflows/mo.yml b/.github/workflows/mo.yml
index 7bbf3ba2800..9a112e7e53c 100644
--- a/.github/workflows/mo.yml
+++ b/.github/workflows/mo.yml
@@ -21,6 +21,7 @@ permissions: read-all
jobs:
Pylint-UT:
runs-on: ubuntu-22.04
+ if: ${{ github.repository_owner == 'openvinotoolkit' }}
steps:
- name: Clone OpenVINO
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
diff --git a/.github/workflows/ovc.yml b/.github/workflows/ovc.yml
index a296f93e5a5..1e2668f26cb 100644
--- a/.github/workflows/ovc.yml
+++ b/.github/workflows/ovc.yml
@@ -16,6 +16,7 @@ permissions: read-all
jobs:
Pylint-UT:
runs-on: ubuntu-22.04
+ if: ${{ github.repository_owner == 'openvinotoolkit' }}
steps:
- name: Clone OpenVINO
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
diff --git a/.github/workflows/py_checks.yml b/.github/workflows/py_checks.yml
index db0918d0eb6..75a8a1b83f0 100644
--- a/.github/workflows/py_checks.yml
+++ b/.github/workflows/py_checks.yml
@@ -25,6 +25,7 @@ permissions: read-all
jobs:
linters:
runs-on: ubuntu-20.04
+ if: ${{ github.repository_owner == 'openvinotoolkit' }}
steps:
- name: Clone OpenVINO
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
diff --git a/.github/workflows/send_workflows_to_opentelemetry.yml b/.github/workflows/send_workflows_to_opentelemetry.yml
index 8f70389e645..ef597e55858 100644
--- a/.github/workflows/send_workflows_to_opentelemetry.yml
+++ b/.github/workflows/send_workflows_to_opentelemetry.yml
@@ -37,7 +37,7 @@ jobs:
otel-export-trace:
name: Export finished workflow metrics
runs-on: aks-linux-2-cores-8gb
- if: github.repository == 'openvinotoolkit/openvino'
+ if: ${{ github.repository_owner == 'openvinotoolkit' }}
steps:
- name: Checkout
diff --git a/.github/workflows/stale_prs_and_issues.yml b/.github/workflows/stale_prs_and_issues.yml
index 395fc6a350e..d246a7e83f4 100644
--- a/.github/workflows/stale_prs_and_issues.yml
+++ b/.github/workflows/stale_prs_and_issues.yml
@@ -12,6 +12,7 @@ jobs:
issues: write
pull-requests: write
runs-on: ubuntu-latest
+ if: ${{ github.repository_owner == 'openvinotoolkit' }}
steps:
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0
with:
diff --git a/.github/workflows/ubuntu_20.yml b/.github/workflows/ubuntu_20.yml
index 5d74284b8c1..df1450a98e4 100644
--- a/.github/workflows/ubuntu_20.yml
+++ b/.github/workflows/ubuntu_20.yml
@@ -54,6 +54,7 @@ jobs:
Docker:
needs: Smart_CI
+ if: "!needs.smart_ci.outputs.skip_workflow"
runs-on: aks-linux-4-cores-16gb-docker-build
container:
image: openvinogithubactions.azurecr.io/docker_build:0.2
@@ -77,7 +78,6 @@ jobs:
Build:
needs: [Docker, Smart_CI]
- if: "!needs.smart_ci.outputs.skip_workflow"
uses: ./.github/workflows/job_build_linux.yml
with:
runner: 'aks-linux-16-cores-32gb'
diff --git a/.github/workflows/ubuntu_22.yml b/.github/workflows/ubuntu_22.yml
index b2a2f78410e..90618357b2c 100644
--- a/.github/workflows/ubuntu_22.yml
+++ b/.github/workflows/ubuntu_22.yml
@@ -56,6 +56,7 @@ jobs:
Docker:
needs: Smart_CI
+ if: "!needs.smart_ci.outputs.skip_workflow"
runs-on: aks-linux-4-cores-16gb-docker-build
container:
image: openvinogithubactions.azurecr.io/docker_build:0.2
@@ -80,7 +81,6 @@ jobs:
Build:
needs: [Docker, Smart_CI]
- if: "!needs.smart_ci.outputs.skip_workflow"
uses: ./.github/workflows/job_build_linux.yml
with:
runner: 'aks-linux-16-cores-32gb'
diff --git a/.github/workflows/ubuntu_22_dpcpp.yml b/.github/workflows/ubuntu_22_dpcpp.yml
index 1a5c69f03fe..1ee9df0095f 100644
--- a/.github/workflows/ubuntu_22_dpcpp.yml
+++ b/.github/workflows/ubuntu_22_dpcpp.yml
@@ -44,6 +44,7 @@ jobs:
Docker:
needs: Smart_CI
+ if: "!needs.smart_ci.outputs.skip_workflow"
runs-on: aks-linux-4-cores-16gb-docker-build
container:
image: openvinogithubactions.azurecr.io/docker_build:0.2
@@ -66,7 +67,6 @@ jobs:
Build:
needs: [Docker, Smart_CI]
- if: "!needs.smart_ci.outputs.skip_workflow"
uses: ./.github/workflows/job_build_linux.yml
with:
runner: 'aks-linux-16-cores-32gb'
diff --git a/.github/workflows/ubuntu_24.yml b/.github/workflows/ubuntu_24.yml
index a0e1b314391..474e8a46ae5 100644
--- a/.github/workflows/ubuntu_24.yml
+++ b/.github/workflows/ubuntu_24.yml
@@ -51,6 +51,7 @@ jobs:
Docker:
needs: Smart_CI
+ if: "!needs.smart_ci.outputs.skip_workflow"
runs-on: aks-linux-4-cores-16gb-docker-build
container:
image: openvinogithubactions.azurecr.io/docker_build:0.2
@@ -74,7 +75,6 @@ jobs:
Build:
needs: [Docker, Smart_CI]
- if: "!needs.smart_ci.outputs.skip_workflow"
uses: ./.github/workflows/job_build_linux.yml
with:
runner: 'aks-linux-16-cores-32gb'
diff --git a/.github/workflows/webassembly.yml b/.github/workflows/webassembly.yml
index 902fb0dfcb0..a4a1a17af9d 100644
--- a/.github/workflows/webassembly.yml
+++ b/.github/workflows/webassembly.yml
@@ -48,6 +48,7 @@ jobs:
Docker:
needs: Smart_CI
+ if: "!needs.smart_ci.outputs.skip_workflow"
runs-on: aks-linux-4-cores-16gb-docker-build
container:
image: openvinogithubactions.azurecr.io/docker_build:0.2
@@ -88,7 +89,6 @@ jobs:
OPENVINO_REPO: /__w/openvino/openvino/openvino
OPENVINO_BUILD_DIR: /__w/openvino/openvino/openvino_build
SCCACHE_AZURE_KEY_PREFIX: webassembly_Release
- if: "!needs.smart_ci.outputs.skip_workflow"
steps:
- name: Clone OpenVINO
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
diff --git a/.github/workflows/workflow_rerunner.yml b/.github/workflows/workflow_rerunner.yml
index 81af7aede70..1c193f35dfa 100644
--- a/.github/workflows/workflow_rerunner.yml
+++ b/.github/workflows/workflow_rerunner.yml
@@ -21,7 +21,8 @@ permissions: read-all
jobs:
rerun:
name: Rerun Workflow
- if: ${{ github.event.workflow_run.conclusion == 'failure' }} # Run only for the failed workflows
+ # Run only for the failed workflows in openvinotoolkit org
+ if: ${{ github.event.workflow_run.conclusion == 'failure' && github.repository_owner == 'openvinotoolkit' }}
runs-on: aks-linux-2-cores-8gb
permissions:
actions: write