Update update-version.yml

This commit is contained in:
Renato Alcara
2026-02-18 12:22:56 -03:00
committed by GitHub
parent 6b0c21b6da
commit 0a80c9fa01
+20 -3
View File
@@ -12,6 +12,9 @@ on:
default: 'false'
type: boolean
# Dynamic run name with version
run-name: "Update WhatsApp Version ${{ github.run_number }}"
permissions:
contents: write
pull-requests: write
@@ -78,6 +81,12 @@ jobs:
echo "exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT
# Read and output the updated version
VERSION=$(cat src/Defaults/baileys-version.json | grep -oP '"version":\s*\[\s*\K[0-9,\s]+' | tr -d ' ')
VERSION_STRING=$(echo $VERSION | sed 's/,/./g')
echo "version=$VERSION_STRING" >> $GITHUB_OUTPUT
echo "📱 WhatsApp Version: $VERSION_STRING"
# Only fail on fatal errors (exit code 1)
if [ $EXIT_CODE -eq 1 ]; then
echo "::error::Script failed with fatal error"
@@ -115,6 +124,7 @@ jobs:
run: |
BRANCH_NAME="update-version/stable"
FORCE="${{ inputs.force }}"
VERSION="${{ steps.update_version.outputs.version }}"
# Configure git
git config user.name "github-actions[bot]"
@@ -133,16 +143,19 @@ jobs:
if [ "$FORCE" == "true" ] && git diff --cached --quiet; then
git commit --allow-empty -m "chore: force WhatsApp Web version check"
else
git commit -m "chore: update WhatsApp Web version"
git commit -m "chore: update WhatsApp Web version to v$VERSION"
fi
git push origin "$BRANCH_NAME"
# Create PR using GitHub CLI
# Create PR using GitHub CLI with version in title
PR_TITLE="chore: update WhatsApp Web version to v$VERSION"
PR_BODY="Automated WhatsApp Web version update.
This PR updates the WhatsApp Web client revision to the latest version fetched from \`web.whatsapp.com\`.
**Version:** \`$VERSION\`
**Single source of truth:**
- \`src/Defaults/baileys-version.json\` (other files import from here)
@@ -157,7 +170,7 @@ jobs:
# Create PR (compatible with older gh CLI versions)
set +e
PR_URL=$(gh pr create \
--title "chore: update WhatsApp Web version" \
--title "$PR_TITLE" \
--body "$PR_BODY" \
--base master \
--head "$BRANCH_NAME" 2>&1)
@@ -283,6 +296,10 @@ jobs:
EXIT_CODE="${{ steps.update_version.outputs.exit_code }}"
HAS_CHANGES="${{ steps.check_changes.outputs.has_changes }}"
FORCE_MODE="${{ steps.check_changes.outputs.force_mode }}"
VERSION="${{ steps.update_version.outputs.version }}"
echo "**Version:** \`$VERSION\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "$EXIT_CODE" == "2" ]; then
echo "⚠️ Warning: Could not fetch latest version from WhatsApp servers" >> $GITHUB_STEP_SUMMARY