Skip to content

Commit

Permalink
Update update-projects.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Circuit-Overtime authored Jan 30, 2025
1 parent 08f05d1 commit 0cc6302
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/update-projects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ jobs:
if [[ -f projects.json ]]; then
OLD_CONTENT=$(cat projects.json)
if [[ $OLD_CONTENT == "" ]]; then
echo "[$JSON_OBJECT]" > projects.json
else
OLD_CONTENT_NO_BRACKETS=$(echo "$OLD_CONTENT" | jq -r .)
NEW_ARRAY_STRING=$(echo "$OLD_CONTENT_NO_BRACKETS" | jq -r --arg new_obj "$JSON_OBJECT" '. + [$new_obj]')
echo "$NEW_ARRAY_STRING" > projects.json
if [[ $OLD_CONTENT == "" ]]; then
echo "[$JSON_OBJECT]" > projects.json
else
NEW_ARRAY_STRING=$(echo "$OLD_CONTENT" | jq --arg new_obj "$JSON_OBJECT" '. + [$new_obj]')
echo "$NEW_ARRAY_STRING" > projects.json
fi
else
echo "[$JSON_OBJECT]" > projects.json
Expand Down

0 comments on commit 0cc6302

Please sign in to comment.