Skip to content

Commit

Permalink
Release tracking: added anon parameter, timestamp, and fixed hyphen r…
Browse files Browse the repository at this point in the history
…eplacement. (#38306)

* Added the anon value to the _ut parameter.

* Added the microseconds timestamp.

* Added greedy matching and hyphen replacement.
  • Loading branch information
zinigor authored Jul 11, 2024
1 parent e76624a commit 56adcdf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion tools/includes/send_tracks_event.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ function send_tracks_event {
local TRACKS_URL TRACKS_RESPONSE USER_AGENT PAYLOAD
TRACKS_URL='https://public-api.wordpress.com/rest/v1.1/tracks/record?http_envelope=1'
USER_AGENT='jetpack-monorepo-cli'
PAYLOAD=$(jq -nr --arg email "$(git config --get user.email)" '.commonProps._ul = $email')
PAYLOAD=$(jq -nr \
--arg email "$(git config --get user.email)" \
'.commonProps = {"_ul": $email, "_ut": "anon", "_rt": ( now * 1000 | round ) }'
)

# Add event name to payload.
PAYLOAD=$(jq -r --arg eventName "$1" '.events = [{_en: $eventName}]' <<< "$PAYLOAD")
Expand Down
4 changes: 2 additions & 2 deletions tools/release-plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ for PLUGIN in "${!PROJECTS[@]}"; do

RELEASED_PLUGINS=$(
jq \
--arg property "$( echo "$PLUGIN" | sed 's/\//_/' )_release_type" \
--arg property "${PLUGIN//[\/-]/_}_release_type" \
--arg value "$VERSION_DIFF" \
'.[ $property ] = $value' <<< "$RELEASED_PLUGINS"
)
RELEASED_PLUGINS=$(
jq \
--arg property "$( echo "$PLUGIN" | sed 's/\//_/' )_version" \
--arg property "${PLUGIN//[\/-]/_}_version" \
--arg value "${PROJECTS[$PLUGIN]}" \
'.[ $property ] = $value' <<< "$RELEASED_PLUGINS"
)
Expand Down

0 comments on commit 56adcdf

Please sign in to comment.