Fixed timestamp format in inventory JSON.

This commit is contained in:
Patrick Lehmann
2025-10-01 00:37:02 +02:00
parent 626d64ef6a
commit 46a2764e73
2 changed files with 22 additions and 24 deletions

View File

@@ -165,7 +165,7 @@ jobs:
ref_kind="branch" ref_kind="branch"
branch="${ref:11}" branch="${ref:11}"
printf " Get default branch name ... " printf "Get default branch name ... "
defaultBranch=$(gh repo view "${{ github.repository }}" --json defaultBranchRef --jq '.defaultBranchRef.name' 2>&1) defaultBranch=$(gh repo view "${{ github.repository }}" --json defaultBranchRef --jq '.defaultBranchRef.name' 2>&1)
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
printf "${ANSI_LIGHT_GREEN} [OK]\n" printf "${ANSI_LIGHT_GREEN} [OK]\n"
@@ -178,43 +178,39 @@ jobs:
fi fi
printf "Commit checks:\n" printf "Commit checks:\n"
printf " Commit kind "
if [[ -z "$(git rev-list -1 --merges ${{ github.sha }}~1..${{ github.sha }})" ]]; then
is_regular_commit="true"
printf "${ANSI_LIGHT_YELLOW}[REGULAR]${ANSI_NOCOLOR}\n"
else
is_merge_commit="true"
printf "${ANSI_LIGHT_GREEN}[MERGE]${ANSI_NOCOLOR}\n"
fi
printf "Branch checks:\n"
if [[ "${branch}" == "${defaultBranch}" ]]; then if [[ "${branch}" == "${defaultBranch}" ]]; then
on_default_branch="true" on_default_branch="true"
printf " Commit on default branch ${ANSI_LIGHT_BLUE}'%s'${ANSI_NOCOLOR}\n" "${defaultBranch}"
printMessage="default branch"
printBranch="${defaultBranch}"
fi fi
if [[ "${branch}" == "${{ inputs.main_branch }}" ]]; then if [[ "${branch}" == "${{ inputs.main_branch }}" ]]; then
on_main_branch="true" on_main_branch="true"
printf " Commit on main branch ${ANSI_LIGHT_BLUE}'%s'${ANSI_NOCOLOR}\n" "${{ inputs.main_branch }}"
printMessage="main branch"
printBranch="${{ inputs.main_branch }}"
fi fi
if [[ "${branch}" == "${{ inputs.release_branch }}" ]]; then if [[ "${branch}" == "${{ inputs.release_branch }}" ]]; then
on_release_branch="true" on_release_branch="true"
printf " Commit on release branch ${ANSI_LIGHT_BLUE}'%s'${ANSI_NOCOLOR}\n" "${{ inputs.release_branch }}"
printMessage="release branch"
printBranch="${{ inputs.release_branch }}"
fi fi
if [[ "${branch}" == "${{ inputs.development_branch }}" ]]; then if [[ "${branch}" == "${{ inputs.development_branch }}" ]]; then
on_dev_branch="true" on_dev_branch="true"
printf " Commit on development branch ${ANSI_LIGHT_BLUE}'%s'${ANSI_NOCOLOR}\n" "${{ inputs.development_branch }}"
printMessage="development branch"
printBranch="${{ inputs.development_branch }}"
fi fi
if [[ -z "$(git rev-list -1 --merges ${{ github.sha }}~1..${{ github.sha }})" ]]; then if [[ "${is_merge_commit}" == "true" ]]; then
is_regular_commit="true" printf "Release checks:\n"
printf " ${ANSI_LIGHT_YELLOW}regular commit${ANSI_NOCOLOR} on ${printMessage} ${ANSI_LIGHT_BLUE}'%s'${ANSI_NOCOLOR}\n" "${printBranch}" printf " Release kind "
else
is_merge_commit="true"
printf " ${ANSI_LIGHT_GREEN}merge commit${ANSI_NOCOLOR} on ${printMessage} ${ANSI_LIGHT_BLUE}'%s'${ANSI_NOCOLOR}\n" "${printBranch}"
printf " Merge kind "
if [[ "${on_main_branch}" == "true" ]]; then if [[ "${on_main_branch}" == "true" ]]; then
is_release_commit="true" is_release_commit="true"
printf "${ANSI_LIGHT_GREEN}[RELEASE]${ANSI_NOCOLOR}\n" printf "${ANSI_LIGHT_GREEN}[RELEASE]${ANSI_NOCOLOR}\n"

View File

@@ -505,9 +505,11 @@ jobs:
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
if [[ -z "${latestVersion}" ]]; then if [[ -z "${latestVersion}" ]]; then
printf "${ANSI_LIGHT_RED}[UNKNOWN]${ANSI_NOCOLOR}\n" printf "${ANSI_LIGHT_RED}[UNKNOWN]${ANSI_NOCOLOR}\n"
printf " latest=unknown\n"
latestVersion="unknown" latestVersion="unknown"
else else
printf "${ANSI_LIGHT_GREEN}[OK]${ANSI_NOCOLOR}\n" printf "${ANSI_LIGHT_GREEN}[OK]${ANSI_NOCOLOR}\n"
printf " latest=%s\n" "${latestVersion}"
fi fi
else else
printf "${ANSI_LIGHT_RED}[ERROR]${ANSI_NOCOLOR}\n" printf "${ANSI_LIGHT_RED}[ERROR]${ANSI_NOCOLOR}\n"
@@ -529,7 +531,7 @@ jobs:
jsonInventory=$(jq -c -n \ jsonInventory=$(jq -c -n \
--arg structVersion "${STRUCT_VERSION}" \ --arg structVersion "${STRUCT_VERSION}" \
--arg date "$(date +"%Y-%m-%dT%H-%M-%S%:z")" \ --arg date "$(date +"%Y-%m-%dT%H:%M:%S%:z")" \
--argjson jsonMeta "$(jq -c -n \ --argjson jsonMeta "$(jq -c -n \
--arg tag "${{ inputs.tag }}" \ --arg tag "${{ inputs.tag }}" \
--arg version "${{ inputs.inventory-version }}" \ --arg version "${{ inputs.inventory-version }}" \