Skip to content

Commit

Permalink
[GHA] Automatically choose merge queue base branch in restore artifac…
Browse files Browse the repository at this point in the history
…ts action (openvinotoolkit#26939)

To avoid failures in merge queue like
https://github.com/openvinotoolkit/openvino_tokenizers/actions/runs/11218446282/job/31182230856
without setting branch directly via action parameter in a workflow
(there is no built-in env var for that unfortunately)
  • Loading branch information
akladiev authored Oct 9, 2024
1 parent 4672d2e commit 73e9c6c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/actions/common/artifact_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
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,
Expand Down
1 change: 1 addition & 0 deletions .github/actions/restore_artifacts/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
1 change: 1 addition & 0 deletions .github/actions/store_artifacts/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""

0 comments on commit 73e9c6c

Please sign in to comment.