fix: improve X post release detection logic#141
Conversation
solidsnakedev
commented
Jan 26, 2026
- Prioritize evolution package when it has real changes
- Filter out releases with only dependency updates
- Fallback to other packages if evolution has no changes
There was a problem hiding this comment.
Pull request overview
This PR tightens the post-release workflow so that tweets are only sent for meaningful @evolution-sdk releases, with preference for the main evolution package. It filters out dependency-only releases and introduces a guard to skip tweeting when no qualifying release is found.
Changes:
- Replace the simple
releases/latestlookup with logic that scans recent@evolution-sdk/*releases, filters out those older than an hour or with only dependency updates, and prioritizes the@evolution-sdk/evolutionpackage while falling back to other packages if needed. - Normalize the selected tag and URL into step outputs (
tag,url,found) used by the tweet step. - Add a conditional on the tweeting step so it only runs when a qualifying release has been found.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| CLEAN_TAG=$(echo $EVOLUTION_TAG | sed 's/@//g') | ||
| echo "tag=$CLEAN_TAG" >> $GITHUB_OUTPUT | ||
| echo "url=$EVOLUTION_URL" >> $GITHUB_OUTPUT | ||
| echo "found=true" >> $GITHUB_OUTPUT | ||
| elif [ -n "$FALLBACK_TAG" ]; then | ||
| CLEAN_TAG=$(echo $FALLBACK_TAG | sed 's/@//g') |
There was a problem hiding this comment.
Using sed 's/@//g' on the tag removes all @ characters, so a tag like @evolution-sdk/evolution@1.2.3 will be turned into evolution-sdk/evolution1.2.3, losing the separator between package and version. If the intent is just to avoid a leading @ (e.g. to prevent a Twitter mention) while keeping the @ before the version, this should strip only a leading @ (or otherwise preserve the package/version separator) instead of removing all occurrences.
| CLEAN_TAG=$(echo $EVOLUTION_TAG | sed 's/@//g') | |
| echo "tag=$CLEAN_TAG" >> $GITHUB_OUTPUT | |
| echo "url=$EVOLUTION_URL" >> $GITHUB_OUTPUT | |
| echo "found=true" >> $GITHUB_OUTPUT | |
| elif [ -n "$FALLBACK_TAG" ]; then | |
| CLEAN_TAG=$(echo $FALLBACK_TAG | sed 's/@//g') | |
| CLEAN_TAG=$(echo $EVOLUTION_TAG | sed 's/^@//') | |
| echo "tag=$CLEAN_TAG" >> $GITHUB_OUTPUT | |
| echo "url=$EVOLUTION_URL" >> $GITHUB_OUTPUT | |
| echo "found=true" >> $GITHUB_OUTPUT | |
| elif [ -n "$FALLBACK_TAG" ]; then | |
| CLEAN_TAG=$(echo $FALLBACK_TAG | sed 's/^@//') |
| EVOLUTION_URL="" | ||
|
|
||
| for i in $(seq 0 10); do | ||
| RELEASE=$(echo $RELEASES | jq ".[$i]") |
There was a problem hiding this comment.
echo $RELEASES | jq ... expands $RELEASES unquoted, which performs word splitting and re-flattens whitespace in the JSON before it reaches jq; while it may work in practice, it is fragile and can break with larger or more complex JSON payloads. To make this more robust, pass the JSON to jq without word splitting (for example by quoting $RELEASES or using printf), so the data structure is preserved exactly as returned by gh api.
| RELEASE=$(echo $RELEASES | jq ".[$i]") | |
| RELEASE=$(printf '%s\n' "$RELEASES" | jq ".[$i]") |