Compare commits
1 commit
353b3d68d5
...
5cabe9d3c6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5cabe9d3c6 |
1 changed files with 13 additions and 0 deletions
13
lib/vault.sh
13
lib/vault.sh
|
|
@ -158,6 +158,19 @@ before execution. See the TOML file for details."
|
||||||
local file_path="vault/actions/${action_id}.toml"
|
local file_path="vault/actions/${action_id}.toml"
|
||||||
_vault_log "Writing ${file_path} to branch ${branch}"
|
_vault_log "Writing ${file_path} to branch ${branch}"
|
||||||
|
|
||||||
|
# Get current file content if exists (for upload API)
|
||||||
|
local current_content=""
|
||||||
|
local file_exists
|
||||||
|
file_exists=$(curl -sf -s -o /dev/null -w "%{http_code}" \
|
||||||
|
-H "Authorization: token ${FORGE_TOKEN}" \
|
||||||
|
"${ops_api}/contents/${file_path}?ref=${branch}" 2>/dev/null || echo "0")
|
||||||
|
|
||||||
|
if [ "$file_exists" = "200" ]; then
|
||||||
|
current_content=$(curl -sf -H "Authorization: token ${FORGE_TOKEN}" \
|
||||||
|
"${ops_api}/contents/${file_path}?ref=${branch}" 2>/dev/null | \
|
||||||
|
jq -r '.content // empty')
|
||||||
|
fi
|
||||||
|
|
||||||
# Encode TOML content as base64
|
# Encode TOML content as base64
|
||||||
local encoded_content
|
local encoded_content
|
||||||
encoded_content=$(printf '%s' "$toml_content" | base64 -w 0)
|
encoded_content=$(printf '%s' "$toml_content" | base64 -w 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue