Skip to content

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

[GHA] Automatically choose merge queue base branch in restore artifacts action (#26939)

Alina Kladieva73e9c6c545c7
diff --git a/.github/actions/common/artifact_utils.py b/.github/actions/common/artifact_utils.py
index 58c96fbe5de..cbef0e76024 100644
--- a/.github/actions/common/artifact_utils.py
+++ b/.github/actions/common/artifact_utils.py
@@ -9,7 +9,9 @@ from .constants import EventType, ProductType, PlatformKey
def add_common_args(parser: argparse.ArgumentParser):
parser.add_argument('-s', '--commit_sha', help='Commit hash for which artifacts were generated', required=True)
parser.add_argument('-b', '--branch_name', help='Name of GitHub branch', required=False,
- default=os.getenv('GITHUB_BASE_REF') or os.getenv('GITHUB_REF_NAME'))
+ default=os.getenv('GITHUB_BASE_REF') or
+ os.getenv('MERGE_QUEUE_BASE_REF').replace('refs/heads/', '') or
+ os.getenv('GITHUB_REF_NAME'))
parser.add_argument('-e', '--event_name', help='Name of GitHub event', required=False,
default=os.getenv('GITHUB_EVENT_NAME'))
parser.add_argument('--storage_root', help='Root path of the artifacts storage', required=False,
diff --git a/.github/actions/restore_artifacts/action.yml b/.github/actions/restore_artifacts/action.yml
index efa0dfe87ae..df5b857cd93 100644
--- a/.github/actions/restore_artifacts/action.yml
+++ b/.github/actions/restore_artifacts/action.yml
@@ -60,3 +60,4 @@ runs:
EVENT_PARAM: "-e ${{ inputs.event_name }}"
TO_RESTORE: "-r ${{ inputs.to_restore }}"
DEFAULT_TARGET_DIR: "${{ env.GITHUB_WORKSPACE }}/${{ inputs.storage_dir || inputs.platform }}"
+ MERGE_QUEUE_BASE_REF: "${{ github.event.merge_group.base_ref }}"
diff --git a/.github/actions/store_artifacts/action.yml b/.github/actions/store_artifacts/action.yml
index 4e50953d8c9..b652f707b75 100644
--- a/.github/actions/store_artifacts/action.yml
+++ b/.github/actions/store_artifacts/action.yml
@@ -60,3 +60,4 @@ runs:
EVENT_PARAM: "-e ${{ inputs.event_name }}"
STORAGE_PARAM: "--storage_dir ${{ inputs.storage_dir }}"
PLATFORM_PARAM: "--platform ${{ inputs.platform }}"
+ MERGE_QUEUE_BASE_REF: ""