1212 runs-on : ubuntu-latest
1313 permissions :
1414 contents : write
15+ actions : read
1516 packages : read
1617 steps :
1718 -
@@ -51,18 +52,17 @@ jobs:
5152 #####
5253 notes_file="$(mktemp)"
5354 {
54- echo "## buildpro container images ${tag}"
55- echo
56- echo "| Image | Container package | Workflow run |"
57- echo "| ----- | ----------------- | ------------ |"
55+ echo "| buildpro docker image | workflow run |"
56+ echo "| --------------------- | ------------ |"
5857 } > "${notes_file}"
5958 for img in "${images[@]}"; do
6059 echo "Processing image: ${img}"
6160 #####
6261 pkg_name="buildpro%2F${img}"
6362 base_pkg_url="https://github.com/${owner}/buildpro/pkgs/container/${pkg_name}/versions"
6463 version_url="${base_pkg_url}"
65- container_status="missing tag ${tag} (see versions list)"
64+ image_ref_text="ghcr.io/${repo}/${img}:${tag}"
65+ image_cell="[ghcr.io/${repo}/${img} versions](${base_pkg_url}) (tag DNE?)"
6666 #####
6767 # Try to find a specific package version that has this tag
6868 # API: GET /orgs/{org}/packages/container/{package_name}/versions
@@ -76,34 +76,46 @@ jobs:
7676 fi
7777 if [ -n "${version_id}" ]; then
7878 version_url="https://github.com/${owner}/buildpro/pkgs/container/${pkg_name}/${version_id}?tag=${tag}"
79- container_status="[link](${version_url})"
80- else
81- container_status="missing tag ${tag} ([versions](${base_pkg_url}))"
79+ image_cell="[${image_ref_text}](${version_url})"
8280 fi
8381 #####
8482 # Determine a specific successful workflow run for this image/tag, if possible
8583 workflow_url="https://github.com/${repo}/actions/workflows/${img}.yml"
8684 run_cell="no matching run (see [workflow](${workflow_url}))"
8785 if [ -n "${tag_sha}" ]; then
8886 run_id=""
87+ api_err_file="$(mktemp)"
8988 if ids=$(gh api \
9089 -H "Accept: application/vnd.github+json" \
9190 "repos/${repo}/actions/workflows/${img}.yml/runs" \
9291 -f per_page=100 \
93- --jq ".workflow_runs[] | select(.head_sha == \"${tag_sha}\" and .conclusion == \"success\") | .id" 2>/dev/null ); then
92+ --jq ".workflow_runs[] | select(.head_sha == \"${tag_sha}\" and .conclusion == \"success\") | .id" 2>"${api_err_file}" ); then
9493 run_id=$(echo "${ids}" | head -n1 || true)
94+ else
95+ api_err=$(cat "${api_err_file}" || true)
96+ run_cell="could not query runs (see [workflow](${workflow_url}))"
97+ if [ -n "${api_err}" ]; then
98+ echo "Warning: failed to query workflow runs for ${img}.yml: ${api_err}" >&2
99+ fi
95100 fi
101+ rm -f "${api_err_file}"
96102 if [ -n "${run_id}" ]; then
97103 specific_run_url="https://github.com/${repo}/actions/runs/${run_id}"
98- run_cell="[run](${specific_run_url})"
104+ run_cell="[${tag} run](${specific_run_url})"
99105 fi
100106 else
101107 run_cell="tag ${tag} not found in git ([workflow](${workflow_url}))"
102108 fi
103109 #####
104110 # Append table row
105- echo "| ${img} | ${container_status } | ${run_cell} |" >> "${notes_file}"
111+ echo "| ${image_cell } | ${run_cell} |" >> "${notes_file}"
106112 done
113+ {
114+ echo
115+ echo "- The \`workflow run\` link includes:"
116+ echo " - links to the attestation and software bill of materials"
117+ echo " - the SBOM is in SPDX (Software Package Data Exchange) format (.spdx.json)"
118+ } >> "${notes_file}"
107119 #####
108120 # Refuse to create a release if one already exists for this tag.
109121 release_tag="${tag}"
0 commit comments