Skip to content

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

initialize_gold_boms: Allow workflow use PR runs (#39037)

Artyom Anokhov1c169aa2c4c0
diff --git a/.github/workflows/initialize_gold_boms.yml b/.github/workflows/initialize_gold_boms.yml
index 35cda79965c..f1682bd1ea7 100644
--- a/.github/workflows/initialize_gold_boms.yml
+++ b/.github/workflows/initialize_gold_boms.yml
@@ -52,11 +52,14 @@ jobs:
added_files=0
while IFS= read -r run_id; do
- run_info=$(gh run view "$run_id" --repo "$GITHUB_REPOSITORY" --json status,conclusion,headBranch)
- if ! jq -e --arg branch "$TARGET_BRANCH" \
- '.status == "completed" and .conclusion == "success" and .headBranch == $branch' \
- <<< "$run_info" >/dev/null; then
- echo "::error::Workflow run ${run_id} must be successful and belong to target branch ${TARGET_BRANCH}."
+ run_info=$(gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}")
+ if ! jq -e --arg repository "$GITHUB_REPOSITORY" \
+ '.repository.full_name == $repository' <<< "$run_info" >/dev/null; then
+ echo "::error::Workflow run ${run_id} must belong to repository ${GITHUB_REPOSITORY}."
+ exit 1
+ fi
+ if ! jq -e '.status == "completed" and .conclusion == "success"' <<< "$run_info" >/dev/null; then
+ echo "::error::Workflow run ${run_id} must be completed successfully."
exit 1
fi
@@ -64,7 +67,7 @@ jobs:
"repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}/artifacts?per_page=100" \
--jq '.artifacts[] | select(.name | startswith("bom_")) | .name')
if [[ -z "$artifact_names" ]]; then
- echo "::error::Workflow run ${run_id} has no BOM artifacts."
+ echo "::error::The provided workflow run ${run_id} does not contain the required BOM artifacts. Verify that you provided the workflow run ID (not a job ID) of a build workflow containing artifacts whose names start with 'bom_'. Check https://github.com/${GITHUB_REPOSITORY}/actions/runs/${run_id} under Summary > Artifacts."
exit 1
fi
diff --git a/docs/dev/ci/github_actions/overview.md b/docs/dev/ci/github_actions/overview.md
index 8e62cb725bc..26f7c537074 100644
--- a/docs/dev/ci/github_actions/overview.md
+++ b/docs/dev/ci/github_actions/overview.md
@@ -248,8 +248,11 @@ architectures, and build variants can each have their own baseline. The platform
inside the artifact is only an artifact layout detail; it is not repeated in the GOLD path.
Run it from **Actions → Initialize GOLD BOM Baseline → Run workflow**, selecting the target
-branch first. Enter a JSON array of successful build run IDs from that same branch, covering
-the configurations to initialize, for example:
+branch first. Enter a JSON array of successful build run IDs from the same repository,
+covering the configurations to initialize. Both PR runs and branch runs are accepted,
+regardless of their source or target branch.
+The branch selected for initialization only determines where the GOLD BOM PR is created.
+For example:
```json
["123456789", "123456790", "123456791"]