Skip to content

Commit

Permalink
Support using any org administrator account for the hostApp creation
Browse files Browse the repository at this point in the history
Change-type: patch
  • Loading branch information
thgreasi committed Dec 12, 2024
1 parent 5bd4848 commit dbd7fcb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/yocto-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -750,9 +750,14 @@ jobs:
# Check if app already exists if it doesn't then create a new one
if [ -z "${_appID}" ] || [ "${_appID}" = "null" ]; then
echo "Fetching ${BALENAOS_ACCOUNT} organization id"
_json=$(${CURL} -XGET "https://api.${API_ENV}/${TRANSLATION}/organization(handle='${BALENAOS_ACCOUNT}')" -H "Content-Type: application/json" -H "Authorization: Bearer ${BALENAOS_TOKEN}")
_orgID=$(echo "${_json}" | jq --raw-output '.id' || true)
echo "${_orgID}"
# https://github.com/balena-os/balena-yocto-scripts/blob/master/automation/include/balena-api.inc#L128
echo "Creating App"
_json=$(${CURL} -XPOST "https://api.${API_ENV}/${TRANSLATION}/application" -H "Content-Type: application/json" -H "Authorization: Bearer ${BALENAOS_TOKEN}" --data "{\"app_name\": \"${BALENAOS_ACCOUNT}/${APPNAME}\", \"device_type\": \"${APPNAME}\"}")
_json=$(${CURL} -XPOST "https://api.${API_ENV}/${TRANSLATION}/application" -H "Content-Type: application/json" -H "Authorization: Bearer ${BALENAOS_TOKEN}" --data "{\"organization\": \"${_orgID}\", \"app_name\": \"${APPNAME}\", \"device_type\": \"${SLUG}\"}")
_appID=$(echo "${_json}" | jq --raw-output '.id' || true)
echo "${_appID}"
Expand Down

0 comments on commit dbd7fcb

Please sign in to comment.